aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Modules/_threadmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r--Modules/_threadmodule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 5d753b4a0eb..b6f878e0752 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -1155,6 +1155,11 @@ thread_PyThread_start_new_thread(PyObject *self, PyObject *fargs)
"thread is not supported for isolated subinterpreters");
return NULL;
}
+ if (interp->finalizing) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "can't create new thread at interpreter shutdown");
+ return NULL;
+ }
struct bootstate *boot = PyMem_NEW(struct bootstate, 1);
if (boot == NULL) {