File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ def _eval_init_subclass(
200200 box = dataclasses .replace (
201201 nbox , orig_cls = box .canonical_cls , args = box .args
202202 )
203- ctx .box_cache [box .cls ] = box
203+ ctx .box_cache [box .alias_type () ] = box
204204 return box
205205
206206
@@ -229,7 +229,7 @@ def _get_update_class_members(
229229
230230 # Get type params from function
231231 if type_params := getattr (init_subclass , '__type_params__' , None ):
232- args [type_params [0 ].__name__ ] = cls
232+ args [type_params [0 ].__name__ ] = box . alias_type ()
233233
234234 init_subclass_annos = _apply_generic .get_annotations (init_subclass , args )
235235
@@ -259,12 +259,6 @@ def _get_update_class_members(
259259 ret_annotation , substitution
260260 )
261261
262- # __init_subclass__ hooks may have annotations that reference the
263- # annotations of the class being defined (e.g. Attrs[T]). These
264- # will call cached_box(T) expecting the original boxed cls, not
265- # the updated one.
266- ctx .box_cache [box .cls ] = box
267-
268262 # Evaluate the return annotation
269263 evaled_ret = _eval_types (ret_annotation , ctx = ctx )
270264
You can’t perform that action at this time.
0 commit comments