gh-138949: Fix non-generic children of generic TypedDicts with future annotations#150762
gh-138949: Fix non-generic children of generic TypedDicts with future annotations#150762sobolevn wants to merge 1 commit into
Conversation
…future annotations
|
|
||
| base_type_params = getattr(typ, "__type_params__", ()) | ||
| for btp in base_type_params: | ||
| if btp.__name__ in seen: |
There was a problem hiding this comment.
this seems wrong, base classes can have another type param with the same name
|
This likely still returns wrong results and/or throws NameError if a stringified annotation refers to a (non-type param) name that is defined in the base class's module but not the child class's. I think to do this fully correctly we'd have to add some data at TypedDict creation time: an annotation dict with just the TypedDict's own non-inherited annotations ( |
This looks a bit messy, any suggestions on we can make this simplier are welcome.
It is really bad that
TypedDictclasses do not create correct__mro__and just copies all annotations :(