Skip to content

Commit 26b5027

Browse files
committed
Use boxed base.
1 parent e1f5289 commit 26b5027

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

typemap/type_eval/_eval_operators.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _eval_init_subclass(
180180
"""Get type after all __init_subclass__ with UpdateClass are evaluated."""
181181
for abox in box.mro[1:]: # Skip the type itself
182182
with _child_context() as ctx:
183-
if ms := _get_update_class_members(box, abox.alias_type(), ctx=ctx):
183+
if ms := _get_update_class_members(box, abox, ctx=ctx):
184184
nbox = _apply_generic.box(
185185
_create_updated_class(box, ms, ctx=ctx)
186186
)
@@ -193,20 +193,22 @@ def _eval_init_subclass(
193193

194194

195195
def _get_update_class_members(
196-
box: _apply_generic.Boxed, base: type, ctx: EvalContext
196+
box: _apply_generic.Boxed,
197+
boxed_base: _apply_generic.Boxed,
198+
ctx: EvalContext,
197199
) -> list[Member] | None:
198200
cls = box.cls
199201

200202
# Get __init_subclass__ from the base class's origin if base is generic.
201-
base_origin = typing.get_origin(base) or base
203+
base_origin = boxed_base.cls
202204
init_subclass = base_origin.__dict__.get("__init_subclass__")
203205
if not init_subclass:
204206
return None
205207
init_subclass = inspect.unwrap(init_subclass)
206208

207209
args = {}
208210
# Get any type params from the base class if it is generic
209-
if (base_args := typing.get_args(base)) and (
211+
if (base_args := boxed_base.args.values()) and (
210212
origin_params := getattr(base_origin, '__type_params__', None)
211213
):
212214
args = dict(

0 commit comments

Comments
 (0)