Message327059
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 |
|
| Date |
User |
Action |
Args |
| 2018-10-04 15:55:03 | lukasz.langa | set | recipients:
+ lukasz.langa, gvanrossum, gregory.p.smith, ivan, scoder, eric.smith, ned.deily, methane, yselivanov, levkivskyi, drhagen |
| 2018-10-04 15:55:03 | lukasz.langa | set | messageid: <1538668503.52.0.545547206417.issue34776@psf.upfronthosting.co.za> |
| 2018-10-04 15:55:03 | lukasz.langa | link | issue34776 messages |
| 2018-10-04 15:55:03 | lukasz.langa | create | |
|