]> granicus.if.org Git - python/commitdiff
Avoid dumping core when PyErr_NormalizeException() is called without
authorGuido van Rossum <guido@python.org>
Mon, 7 Aug 2000 19:18:27 +0000 (19:18 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 7 Aug 2000 19:18:27 +0000 (19:18 +0000)
an exception set.  This shouldn't happen, but we see it at times...

Python/errors.c

index 24eeead9cec552d6d7cf09afdd5744fb117c11cf..a9e4daed9b536e61e7809d78ae77d312d0fa9fd3 100644 (file)
@@ -136,6 +136,12 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
        PyObject *value = *val;
        PyObject *inclass = NULL;
 
+       if (type == NULL) {
+               /* This is a bug.  Should never happen.  Don't dump core. */
+               PyErr_SetString(PyExc_SystemError,
+                       "PyErr_NormalizeException() called without exception");
+       }
+
        /* If PyErr_SetNone() was used, the value will have been actually
           set to NULL.
        */