Skip to content

Commit ed473a4

Browse files
committed
Avoid dumping core when PyErr_NormalizeException() is called without
an exception set. This shouldn't happen, but we see it at times...
1 parent 18c2aa2 commit ed473a4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Python/errors.c

+6
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
136136
PyObject *value = *val;
137137
PyObject *inclass = NULL;
138138

139+
if (type == NULL) {
140+
/* This is a bug. Should never happen. Don't dump core. */
141+
PyErr_SetString(PyExc_SystemError,
142+
"PyErr_NormalizeException() called without exception");
143+
}
144+
139145
/* If PyErr_SetNone() was used, the value will have been actually
140146
set to NULL.
141147
*/

0 commit comments

Comments
 (0)