Message 62079 - Python tracker (original) (raw)
Py_Main calls WaitForThreadShutdown before calling Py_Finalize, which should wait for all these threads to finish shutting down before it starts wiping their globals.
However, if SystemExit is raised (such as via sys.exit()), Py_Exit is called, and it directly calls Py_Finalize, bypassing the WaitForThreadShutdown.
Can someone who's experienced this bug check if they're using SystemExit/sys.exit?