New submission from Fabian.M <[email protected]>:
The following code throws with "NameError: name 'Nested' is not defined".
For reference, it works well when moving class definitions out of the local
scope.
import typing
T = typing.TypeVar('T')
def test():
class Nested(typing.Generic[T]):
pass
class Test(typing.Generic[T]):
nested: Nested[T]
typing.get_type_hints(Test) # this throws
test()
----------
components: Library (Lib)
messages: 384332
nosy: Fabian.M
priority: normal
severity: normal
status: open
title: get_type_hints throws for local class reference
type: behavior
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42824>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com