Message377569
Reproducer:
def test_forward_type_references(self):
def foo(a: 'Foo') -> 'Bar': pass
class Foo: pass
class Bar: pass
get_type_hints(foo)
The above gives the following exception, rather than resolving the type:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py:1001: in get_type_hints
value = _eval_type(value, globalns, localns)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py:260: in _eval_type
return t._evaluate(globalns, localns)
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py:464: in _evaluate
eval(self.__forward_code__, globalns, localns),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E NameError: name 'Foo' is not defined |
|
Date |
User |
Action |
Args |
2020-09-27 13:58:04 | cjw296 | set | recipients:
+ cjw296 |
2020-09-27 13:58:04 | cjw296 | set | messageid: <1601215084.02.0.220244006466.issue41872@roundup.psfhosted.org> |
2020-09-27 13:58:03 | cjw296 | link | issue41872 messages |
2020-09-27 13:58:03 | cjw296 | create | |
|