This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Lincoln Quirk, steven.daprano
Date 2019-01-26.17:44:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548524657.97.0.526286858639.issue35834@roundup.psfhosted.org>
In-reply-to
Content
Wait, I just noticed that PEP563 says:

"Note: if an annotation was a string literal already, it will still be wrapped in a string."

https://www.python.org/dev/peps/pep-0563/#id5

In 3.8.0a I get this:

py> from __future__ import annotations
py>
py> class A:
...     f: 'Undef'
...
py> A.__annotations__
{'f': "'Undef'"}

which matches what the PEP says. So I expect that when calling get_type_hints it should return the unquoted string, rather than a ForwardReference.

get_type_hints(A)

expected {'f': 'Undef'}
actually got {'f': ForwardRef('Undef')}
History
Date User Action Args
2019-01-26 17:44:19steven.dapranosetrecipients: + steven.daprano, Lincoln Quirk
2019-01-26 17:44:17steven.dapranosetmessageid: <1548524657.97.0.526286858639.issue35834@roundup.psfhosted.org>
2019-01-26 17:44:17steven.dapranolinkissue35834 messages
2019-01-26 17:44:17steven.dapranocreate