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
{{ message }}
Repository navigation
PEP 695: typing.TypeVar should be subclassable #104662
Previously typing.TypeVar could be subclassed, and typing_extensions actually does this. However, the new C implementation of TypeVar doesn't allow subclassing. For compatibility, let's restore the ability to subclass it.
Looking more at the previous implementation, it wasn't actually subclassable normally, only if you passed the special _root=True argument to __init_subclass__:
Activity
JelleZijlstra commentedon May 19, 2023
Looking more at the previous implementation, it wasn't actually subclassable normally, only if you passed the special
_root=Trueargument to__init_subclass__:cpython/Lib/typing.py
Line 397 in 702ce87
That was an explicitly private API, so I don't think we need to preserve this behavior in C.
JelleZijlstra commentedon May 20, 2023
Alternative solution in python/typing_extensions#162.