Łukasz Langa <luk...@langa.pl> added the comment:

Yury, thanks for your patch. I'll review it soon.

Please note that postponed annotations only reveal a problem that we already 
had if anybody used a string forward reference:

>>> from dataclasses import dataclass
>>> from typing import get_type_hints
>>> class C:
...   pass
...
>>> @dataclass
... class D:
...   c: C
...
>>> @dataclass
... class E:
...   c: "C"
...
>>> get_type_hints(C.__init__)
{}
>>> get_type_hints(D.__init__)
{'c': <class '__main__.C'>, 'return': <class 'NoneType'>}
>>> get_type_hints(E.__init__)
Traceback (most recent call last):
...
NameError: name 'C' is not defined

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34776>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to