Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Closed
Description
Py_FinalizeEx()
calls_PyObject_DebugMallocStats()
which calls indirectly_PyInterpreterState_GET()
. Problem: at this point, there is no "interpreter" anymore, and so_PyInterpreterState_GET()
fails with a fatal error.
It's a regression introduced by commitdf3173d. Python 3.12 is also affected.
Reproducer:
$ PYTHONMALLOCSTATS=1 ./python -c passSmall block threshold = 512, in 32 size classes.(...)Total = 262,144Small block threshold = 512, in 32 size classes.(...)Total = 655,360Fatal Python error: _PyInterpreterState_GET: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)Python runtime state: finalizing (tstate=0x0000000000ae7550)Abandon (core dumped)