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

Update native_thread_id after fork
(cherry picked from commit d52d4942cf)

Co-authored-by: Gabriele N. Tornetta <P403n1x87@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-01-01 06:50:56 -08:00 committed by GitHub
parent 7ed7127876
commit d0a9bc5a89
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

@ -591,6 +591,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;