You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to #96771, inheriting from typing.Annotated is a feature and is expected to work. However, it breaks when used with generic classes. Minimal example:
TypeError: _GenericAlias.__init__() takes 3 positional arguments but 4 were given
However, it works if I use C without arguments:
classD(typing.Annotated[C, 123]):
pass
AFAICT, the reason is that Annotated[C[int], 123] sets __origin__ to C[int] instead of C like all other generics. This change in _AnnotatedAlias.__init__ fixes the issue:
Activity
pythongh-108394: Fix subclassing annotated generic alias