Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 45827:27e7dc2e6290 legacy-trunk
Issue #2341: Add a Py3k warning when raising an exception that doesn't
derive from BaseException.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 18 Mar 2008 04:26:48 +0000 |
| parents | 79fdc88ff9ec |
| children | 84bb7701efba |
line wrap: on
line diff
--- a/Python/ceval.c Tue Mar 18 04:16:06 2008 +0000 +++ b/Python/ceval.c Tue Mar 18 04:26:48 2008 +0000 @@ -3161,6 +3161,15 @@ 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;
