Sergei Lebedev <[email protected]> added the comment:
Is it worth also addressing the case where a @dataclass/typing.TypeDict class
is defined within a function?
```
from __future__ import annotations
import typing
from dataclasses import dataclass
def make_A():
import collections
@dataclass
class A:
x: collections.defaultdict
return A
A = make_A()
@dataclass
class B(A):
y: int
# NameError: name 'collections' is not defined
print(typing.get_type_hints(B.__init__))
```
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45524>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com