diff options
author | Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com> | 2019-09-05 16:06:49 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-09-05 16:06:49 (GMT) |
commit | 2bc43cdc015eda4f1a651bb2b308a17a83c38e14 (patch) | |
tree | 1a3a998656035eedb1e30c033f7fc3bb3156cdd9 /Modules/_threadmodule.c | |
parent | 2c2b561967c1916855399f809e30ae0ba7e09ae2 (diff) | |
download | cpython-2bc43cdc015eda4f1a651bb2b308a17a83c38e14.zip cpython-2bc43cdc015eda4f1a651bb2b308a17a83c38e14.tar.gz cpython-2bc43cdc015eda4f1a651bb2b308a17a83c38e14.tar.bz2 |
bpo-37878: Remove PyThreadState_DeleteCurrent() function (GH-15315)
* Rename PyThreadState_DeleteCurrent()
to _PyThreadState_DeleteCurrent()
* Move it to the internal C API
Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r-- | Modules/_threadmodule.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index a3ecd2e..1c7df3f 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -993,6 +993,7 @@ struct bootstate { PyObject *args; PyObject *keyw; PyThreadState *tstate; + _PyRuntimeState *runtime; }; static void @@ -1000,11 +1001,13 @@ t_bootstrap(void *boot_raw) { struct bootstate *boot = (struct bootstate *) boot_raw; PyThreadState *tstate; + _PyRuntimeState *runtime; PyObject *res; + runtime = boot->runtime; tstate = boot->tstate; tstate->thread_id = PyThread_get_thread_ident(); - _PyThreadState_Init(&_PyRuntime, tstate); + _PyThreadState_Init(runtime, tstate); PyEval_AcquireThread(tstate); tstate->interp->num_threads++; res = PyObject_Call(boot->func, boot->args, boot->keyw); @@ -1025,13 +1028,14 @@ t_bootstrap(void *boot_raw) PyMem_DEL(boot_raw); tstate->interp->num_threads--; PyThreadState_Clear(tstate); - PyThreadState_DeleteCurrent(); + _PyThreadState_DeleteCurrent(runtime); PyThread_exit_thread(); } static PyObject * thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) { + _PyRuntimeState *runtime = &_PyRuntime; PyObject *func, *args, *keyw = NULL; struct bootstate *boot; unsigned long ident; @@ -1062,6 +1066,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) boot->args = args; boot->keyw = keyw; boot->tstate = _PyThreadState_Prealloc(boot->interp); + boot->runtime = runtime; if (boot->tstate == NULL) { PyMem_DEL(boot); return PyErr_NoMemory(); |