gh-100649: Update native_thread_id after fork (gh-100650)

Update native_thread_id after fork
This commit is contained in:
Gabriele N. Tornetta 2023-01-01 14:20:38 +00:00 committed by GitHub
parent e83f88a455
commit d52d4942cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -0,0 +1 @@
Update the native_thread_id field of PyThreadState after fork.

View file

@ -595,6 +595,10 @@ PyOS_AfterFork_Child(void)
PyThreadState *tstate = _PyThreadState_GET();
_Py_EnsureTstateNotNULL(tstate);
#ifdef PY_HAVE_THREAD_NATIVE_ID
tstate->native_thread_id = PyThread_get_thread_native_id();
#endif
status = _PyEval_ReInitThreads(tstate);
if (_PyStatus_EXCEPTION(status)) {
goto fatal_error;