Visitar URL original
gh-104341: Clean Up threading Module by ericsnowcurrently · Pull Request #104552 · python/cpython · GitHub
Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Drop bootstate.interp and bootstate.runtime.
  • Loading branch information
ericsnowcurrently committed May 15, 2023
commit b3474f3d65b9e7078ebbf6ca71abad8ee01d5fdd
7 changes: 1 addition & 6 deletions Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,12 +1048,10 @@ _localdummy_destroyed(PyObject *localweakref, PyObject *dummyweakref)
/* Module functions */

struct bootstate {
PyInterpreterState *interp;
PyObject *func;
PyObject *args;
PyObject *kwargs;
PyThreadState *tstate;
_PyRuntimeState *runtime;
};


Expand Down Expand Up @@ -1122,7 +1120,6 @@ and False otherwise.\n");
static PyObject *
thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
{
_PyRuntimeState *runtime = &_PyRuntime;
PyObject *func, *args, *kwargs = NULL;

if (!PyArg_UnpackTuple(fargs, "start_new_thread", 2, 3,
Expand Down Expand Up @@ -1160,16 +1157,14 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
if (boot == NULL) {
return PyErr_NoMemory();
}
boot->interp = _PyInterpreterState_GET();
boot->tstate = _PyThreadState_New(boot->interp);
boot->tstate = _PyThreadState_New(interp);
if (boot->tstate == NULL) {
PyMem_Free(boot);
if (!PyErr_Occurred()) {
return PyErr_NoMemory();
}
return NULL;
}
boot->runtime = runtime;
boot->func = Py_NewRef(func);
boot->args = Py_NewRef(args);
boot->kwargs = Py_XNewRef(kwargs);
Expand Down