[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

2020-01-27 Thread Wojciech Łopata
Wojciech Łopata added the comment: I thought of this behaviour as a bug, because PEP 563 mentions breaking "applications depending on arbitrary objects to be directly present in annotations", while it is also breaking users of dataclasses.fields(), that is a part of the standa

[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

2020-01-24 Thread Wojciech Łopata
Wojciech Łopata added the comment: > Isn't that the entire point of "from __future__ import annotations"? I'm not complaining about Foo.__annotations__ storing strings instead of types. I'm complaining about dataclass.Field.type being a string instead of type. I don't think the

[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

2020-01-24 Thread Wojciech Łopata
Change by Wojciech Łopata : -- title: from __future__ import annotations breaks dataclasses.Field.type -> from __future__ import annotations makes dataclasses.Field.type a string, not type ___ Python tracker <https://bugs.python.org/issu

[issue39442] from __future__ import annotations breaks dataclasses.Field.type

2020-01-24 Thread Wojciech Łopata
New submission from Wojciech Łopata : I've checked this behaviour under Python 3.7.5 and 3.8.1. ``` from __future__ import annotations from dataclasses import dataclass, fields @dataclass class Foo: x: int print(fields(Foo)[0].type) ``` With annotations imported, the `type` field