@@ -2005,6 +2005,17 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs)
20052005 return PyErr_NewExceptionWithDoc (name , doc , base , dict );
20062006}
20072007
2008+ /* Test that the fatal error from not having a current thread doesn't
2009+ cause an infinite loop. Run via Lib/test/test_capi.py */
2010+ static PyObject *
2011+ crash_no_current_thread (PyObject * self )
2012+ {
2013+ Py_BEGIN_ALLOW_THREADS
2014+ PyErr_SetString (PyExc_SystemError , "bork bork bork ");
2015+ Py_END_ALLOW_THREADS
2016+ return NULL ;
2017+ }
2018+
20082019static PyMethodDef TestMethods [] = {
20092020 {"raise_exception" , raise_exception , METH_VARARGS },
20102021 {"raise_memoryerror" , (PyCFunction )raise_memoryerror , METH_NOARGS },
@@ -2069,6 +2080,7 @@ static PyMethodDef TestMethods[] = {
20692080 {"code_newempty" , code_newempty , METH_VARARGS },
20702081 {"make_exception_with_doc" , (PyCFunction )make_exception_with_doc ,
20712082 METH_VARARGS | METH_KEYWORDS },
2083+ {"crash_no_current_thread" , (PyCFunction )crash_no_current_thread , METH_NOARGS },
20722084 {NULL , NULL } /* sentinel */
20732085};
20742086
0 commit comments