[issue43463] typing.get_type_hints with TYPE_CHECKING imports / getting hints for single argument

Guido van Rossum report at bugs.python.org
Fri Apr 16 11:07:25 EDT 2021


Guido van Rossum <guido at python.org> added the comment:

Hey Larry, it would seem that PEP 649 as currently specified would make it impossible to access annotations via the inspect module in cases where x.__annotations__ raises (because one of the annotations references an undefined variable).

I really think that we need *some* way of accessing partial annotations. Even just leaving the failing key out of __annotations__ (but keeping other keys if their annotation works) would be better than failing to return an __annotations__ dict at all.

----------
nosy: +larry

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43463>
_______________________________________


More information about the Python-bugs-list mailing list