mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
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:
parent
bbee57fa8c
commit
5a76d1be8e
4 changed files with 46 additions and 0 deletions
|
|
@ -646,6 +646,7 @@ PyOS_AfterFork_Child(void)
|
|||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
_Py_EnsureTstateNotNULL(tstate);
|
||||
|
||||
assert(tstate->thread_id == PyThread_get_thread_ident());
|
||||
#ifdef PY_HAVE_THREAD_NATIVE_ID
|
||||
tstate->native_thread_id = PyThread_get_thread_native_id();
|
||||
#endif
|
||||
|
|
@ -655,6 +656,9 @@ PyOS_AfterFork_Child(void)
|
|||
_Py_qsbr_after_fork((_PyThreadStateImpl *)tstate);
|
||||
#endif
|
||||
|
||||
// Ideally we could guarantee tstate is running main.
|
||||
_PyInterpreterState_ReinitRunningMain(tstate);
|
||||
|
||||
status = _PyEval_ReInitThreads(tstate);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
goto fatal_error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue