[issue39220] constant folding affects annotations despite 'from __future__ import annotations'

Carl Friedrich Bolz-Tereick report at bugs.python.org
Mon Jan 6 07:57:35 EST 2020


Carl Friedrich Bolz-Tereick <cfbolz at gmx.de> added the comment:

I don't have a particularly deep opinion on what should be done, just a bit of weirdness I hit upon while implementing the PEP in PyPy. fwiw, we implement it as an AST transformer that the compiler runs before running the optimizer to make sure that the AST optimizations don't get applied to annotions. The transformer replaces all annotations with a Constant ast node, containing the unparsed string.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39220>
_______________________________________


More information about the Python-bugs-list mailing list