This commit is contained in:
Benjamin Peterson 2011-07-15 14:10:35 -05:00
commit e92cd0ce98
3 changed files with 19 additions and 0 deletions

View file

@ -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;