Skip to content

Properly support UpdateClass on generic types#93

Merged
dnwpark merged 11 commits intomainfrom
updateclass-generic-base
Feb 11, 2026
Merged

Properly support UpdateClass on generic types#93
dnwpark merged 11 commits intomainfrom
updateclass-generic-base

Conversation

@dnwpark
Copy link
Contributor

@dnwpark dnwpark commented Feb 11, 2026

A series of dubious fixes to support generic base and derived types which have __init_subclass__ -> UpdateClass

@dnwpark dnwpark requested a review from msullivan February 11, 2026 18:54

def _get_update_class_members(
cls: type, base: type, ctx: typing.Any
box: _apply_generic.Boxed, base: type, ctx: EvalContext
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably pass a Boxed for base instead. We have one, but we call alias_type() on it, and then have to extract a bunch of info that was more easily available in the `Boxed.

ret_annotation, substitution
)

# __init_subclass__ hooks may have annotations that reference the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain I follow the case here?

The modified version still makes it into the cache eventually, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting confused with what was actually going into the cache. Removed this weirdness.

@vercel
Copy link

vercel bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
python-typemap Ready Ready Preview, Comment Feb 11, 2026 9:10pm

@dnwpark dnwpark force-pushed the updateclass-generic-base branch from 26b5027 to da650e4 Compare February 11, 2026 22:45
@dnwpark dnwpark merged commit 28d3ef6 into main Feb 11, 2026
3 checks passed
@dnwpark dnwpark deleted the updateclass-generic-base branch February 11, 2026 22:46
Comment on lines +223 to +225
if (base_args := boxed_base.args.values()) and (
origin_params := getattr(base_origin, '__type_params__', None)
):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use str_args?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants