Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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')}

----------

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

Reply via email to