diff options
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d66d97e56b..dc1aa52eec 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3161,6 +3161,15 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) type->ob_type->tp_name); goto raise_error; } + + assert(PyExceptionClass_Check(type)); + if (Py_Py3kWarningFlag && PyClass_Check(type)) { + if (PyErr_Warn(PyExc_DeprecationWarning, + "exceptions must derive from BaseException " + "in 3.x") == -1) + goto raise_error; + } + PyErr_Restore(type, value, tb); if (tb == NULL) return WHY_EXCEPTION; |