[issue42882] Restarting the interpreter causes UB on 3.10.0a4

STINNER Victor report at bugs.python.org
Mon Jan 11 12:05:18 EST 2021


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

Oh. In _PyUnicode_FromId(), I made the assumption that _PyRuntime is left unchanged when Py_Initialize()Py_Finalize() is called multiple times. But I was wrong, it is always reset to zero. So I wrote PR 24193 to explicitly save/restore _PyRuntime.unicode_ids.next_index value.

Using PR 24193, msg384761 example displays "Works" instead of failing with a Python fatal error.

----------

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


More information about the Python-bugs-list mailing list