From e11fc032a75d067d2167a21037722a770b9dfb51 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Mon, 30 Jan 2023 12:07:48 -0700 Subject: gh-59956: Clarify Runtime State Status Expectations (gh-101308) A PyThreadState can be in one of many states in its lifecycle, represented by some status value. Those statuses haven't been particularly clear, so we're addressing that here. Specifically: * made the distinct lifecycle statuses clear on PyThreadState * identified expectations of how various lifecycle-related functions relate to status * noted the various places where those expectations don't match the actual behavior At some point we'll need to address the mismatches. (This change also includes some cleanup.) https://github.com/python/cpython/issues/59956 --- Modules/_threadmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/_threadmodule.c') diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index bf4b6ec00e3..9c12c696757 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -1161,7 +1161,7 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs) return PyErr_NoMemory(); } boot->interp = _PyInterpreterState_GET(); - boot->tstate = _PyThreadState_Prealloc(boot->interp); + boot->tstate = _PyThreadState_New(boot->interp); if (boot->tstate == NULL) { PyMem_Free(boot); if (!PyErr_Occurred()) { -- cgit v1.2.3