[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

STINNER Victor report at bugs.python.org
Tue Dec 7 12:27:51 EST 2021


STINNER Victor <vstinner at python.org> added the comment:

> Depending on how the stdlib abc.py file was loaded (in the main interpreter and in the subinterpreter), __code__.co_freevars[0] may or may not be an interned string.

When the bug occurs, I see that the Python stdlib abc.py file is loaded twice: the main interpreter builds a code object, and then subinterpreter builds its own code object: same content, but different Python object (at different memory addresses so inequal pointers!).

I modified reproducer.c to add "Py_VerboseFlag = 1;" before the Py_Initialize() call. Truncated output:
---
...
# code object from /opt/py310/lib/python3.10/abc.py
...
# code object from /opt/py310/lib/python3.10/abc.py
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
...
RuntimeError: super(): __class__ cell not found
...
---

----------

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


More information about the Python-bugs-list mailing list