[issue42829] get_type_hints throws for nested class with __future__ annotations
Svyatoslav
report at bugs.python.org
Tue Jan 5 06:18:32 EST 2021
New submission from Svyatoslav <prometheus3375 at gmail.com>:
If a class X has nested class Y and class X has annotation Y AFTER the definition of Y, get_type_hints(X) throws NameError if import from future annotations is present.
This is because get_type_hints looks only at mro of the class. Its namespace must be included too as locals.
----------
files: annotations.py
messages: 384381
nosy: Prometheus3375
priority: normal
severity: normal
status: open
title: get_type_hints throws for nested class with __future__ annotations
versions: Python 3.9
Added file: https://bugs.python.org/file49719/annotations.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42829>
_______________________________________
More information about the Python-bugs-list
mailing list