diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 5c93637..6d49363 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3494,6 +3494,13 @@ do_raise(PyObject *exc, PyObject *cause) value = PyObject_CallObject(exc, NULL); if (value == NULL) goto raise_error; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto raise_error; + } } else if (PyExceptionInstance_Check(exc)) { value = exc; |