deff():
withopen("x.py", encoding="utf-8") asf:
exec(compile(f.read(), "x.py", "exec"))
returnlocals()["xxx"]
print(f())$ python3.12 readx.py
118888
$ python3.13 readx.py
Traceback (most recent call last):
File ".../readx.py", line 6, in <module>print(f())
~^^
File ".../readx.py", line 4, in freturnlocals()["xxx"]
~~~~~~~~^^^^^^^KeyError: 'xxx'
This breaks e.g. pillow 10.3.0 which has:
defget_version():
version_file="src/PIL/_version.py"withopen(version_file, encoding="utf-8") asf:
exec(compile(f.read(), version_file, "exec"))
returnlocals()["__version__"]
Bug report
Bug description:
x.py
readx.py
shell
This breaks e.g. pillow 10.3.0 which has:
In https://github.com/python-pillow/Pillow/blob/10.3.0/setup.py#L23
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs