bpo-46008: Stop calling _PyThreadState_Init() in new_threadstate(). (gh-29973)

This simplifies new_threadstate().  We also rename _PyThreadState_Init() to _PyThreadState_SetCurrent() to reflect what it actually does.

https://bugs.python.org/issue46008
This commit is contained in:
Eric Snow 2021-12-07 17:26:29 -07:00 committed by GitHub
parent 9b577cd01f
commit 1f384e3184
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 10 deletions

View file

@ -6,7 +6,7 @@
#include "pycore_interp.h" // _PyInterpreterState.threads.count
#include "pycore_moduleobject.h" // _PyModule_GetState()
#include "pycore_pylifecycle.h"
#include "pycore_pystate.h" // _PyThreadState_Init()
#include "pycore_pystate.h" // _PyThreadState_SetCurrent()
#include <stddef.h> // offsetof()
#include "structmember.h" // PyMemberDef
@ -1087,7 +1087,7 @@ thread_run(void *boot_raw)
#else
tstate->native_thread_id = 0;
#endif
_PyThreadState_Init(tstate);
_PyThreadState_SetCurrent(tstate);
PyEval_AcquireThread(tstate);
tstate->interp->threads.count++;