Closed
Description
Bug report
Bug description:
% ./python.exe
Python 3.14.0a0 (heads/main:e12a6780bb, May 22 2024, 13:54:40) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(x: y): pass
...
>>> f.__annotations__
{'x': 'y'}
This likely happens because the code is exec()'ed in a file that has the future import; exec() inherits the __future__
state from the file where it's called (a questionable feature but that's how it is).
For what it's worth, PEP 649 explicitly says the REPL should continue to use "stock" semantics: https://peps.python.org/pep-0649/#interactive-repl-shell.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
### Tasks