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
Backport support for get_type_hints on lone stringified ClassVar #643
This is unfortunate, as python/cpython#90711 addressed this for Python 3.11+, so it would be nice if typing-extensions backported this fix for older python versions.
changed the title [-]Backport support for lone stringified ClassVar (python/cpython#90711)[/-][+]Backport support for get_type_hints on lone stringified ClassVar[/+]on Aug 10, 2025
>>> get_type_hints(Foo)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jelle/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none/lib/python3.10/typing.py", line 1833, in get_type_hints
value = _eval_type(value, base_globals, base_locals)
File "/Users/jelle/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none/lib/python3.10/typing.py", line 327, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
File "/Users/jelle/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none/lib/python3.10/typing.py", line 693, in _evaluate
type_ = _type_check(
File "/Users/jelle/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none/lib/python3.10/typing.py", line 171, in _type_check
raise TypeError(f"Plain {arg} is not valid as type argument")
TypeError: Plain typing.ClassVar is not valid as type argument
Fixing this likely requires duplicating much of that call stack.
Activity
[-]Backport python/cpython#90711[/-][+]Backport support for lone stringified ClassVar (python/cpython#90711)[/+][-]Backport support for lone stringified ClassVar (python/cpython#90711)[/-][+]Backport support for get_type_hints on lone stringified ClassVar[/+]JelleZijlstra commentedon Aug 11, 2025
For reference this is the stack trace on 3.10:
Fixing this likely requires duplicating much of that call stack.