-
-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
Currently, both typing.get_type_hints
and typing_extensions.get_type_hints
fail on a lone stringified ClassVar
annotation in Python 3.9 and 3.10:
from __future__ import annotations
from typing import ClassVar, get_type_hints as get_type_hints
from typing_extensions import get_type_hints as get_type_hints_ext
class Foo:
MY_CLASS_CONSTANT: ClassVar = 5
try:
_ = get_type_hints(Foo)
except TypeError as exc:
print(exc)
try:
_ = get_type_hints_ext(Foo)
except TypeError as exc:
print(exc)
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.
Metadata
Metadata
Assignees
Labels
No labels