Message334398
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')} |
|
Date |
User |
Action |
Args |
2019-01-26 17:44:19 | steven.daprano | set | recipients:
+ steven.daprano, Lincoln Quirk |
2019-01-26 17:44:17 | steven.daprano | set | messageid: <1548524657.97.0.526286858639.issue35834@roundup.psfhosted.org> |
2019-01-26 17:44:17 | steven.daprano | link | issue35834 messages |
2019-01-26 17:44:17 | steven.daprano | create | |
|