gh-105716: Update interp->threads.main After Fork (gh-117049)

I missed this in gh-109921.

We also update Py_Exit() to call _PyInterpreterState_SetNotRunningMain(), if necessary.
This commit is contained in:
Eric Snow 2024-03-21 10:06:35 -06:00 committed by GitHub
parent bbee57fa8c
commit 5a76d1be8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 0 deletions

View file

@ -3138,6 +3138,10 @@ call_ll_exitfuncs(_PyRuntimeState *runtime)
void _Py_NO_RETURN
Py_Exit(int sts)
{
PyThreadState *tstate = _PyThreadState_GET();
if (tstate != NULL && _PyThreadState_IsRunningMain(tstate)) {
_PyInterpreterState_SetNotRunningMain(tstate->interp);
}
if (Py_FinalizeEx() < 0) {
sts = 120;
}