[issue39220] constant folding affects annotations despite 'from __future__ import annotations'
Carl Friedrich Bolz-Tereick
report at bugs.python.org
Sun Jan 5 08:26:51 EST 2020
New submission from Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>:
PEP 563 interacts in weird ways with constant folding. running the following code:
```
from __future__ import annotations
def f(a: 5 + 7) -> a ** 39:
return 12
print(f.__annotations__)
```
I would expect this output:
```
{'a': '5 + 7', 'return': 'a ** 39'}
```
But I get:
```
{'a': '12', 'return': 'a ** 39'}
```
----------
components: Interpreter Core
files: x.py
messages: 359341
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: constant folding affects annotations despite 'from __future__ import annotations'
versions: Python 3.7
Added file: https://bugs.python.org/file48827/x.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39220>
_______________________________________
More information about the Python-bugs-list
mailing list