diff -r dc407f50e823 Modules/_threadmodule.c --- a/Modules/_threadmodule.c Sat Nov 26 13:50:21 2016 +0200 +++ b/Modules/_threadmodule.c Sun Nov 27 16:32:57 2016 +0900 @@ -1050,12 +1050,16 @@ } if (keyw != NULL && !PyDict_Check(keyw)) { PyErr_SetString(PyExc_TypeError, "optional 3rd arg must be a dictionary"); return NULL; } + if (_Py_Finalizing != NULL) { + PyErr_SetString(ThreadError, "python is finalizing"); + return NULL; + } boot = PyMem_NEW(struct bootstate, 1); if (boot == NULL) return PyErr_NoMemory(); boot->interp = PyThreadState_GET()->interp; boot->func = func; boot->args = args;