mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Issue #2341: Add a Py3k warning when raising an exception that doesn't
derive from BaseException.
This commit is contained in:
parent
a5573b3153
commit
504153d55b
2 changed files with 11 additions and 1 deletions
|
@ -13,7 +13,8 @@ Core and builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
- Issue #2371: Add a Py3k warning when catching an exception that
|
- Issue #2371: Add a Py3k warning when catching an exception that
|
||||||
doesn't derive from BaseException.
|
doesn't derive from BaseException. Issue #2341: Add a Py3k warning
|
||||||
|
when raising an exception that doesn't derive from BaseException.
|
||||||
|
|
||||||
- Issue #2321: use pymalloc for unicode object string data to reduce
|
- Issue #2321: use pymalloc for unicode object string data to reduce
|
||||||
memory usage in some circumstances.
|
memory usage in some circumstances.
|
||||||
|
|
|
@ -3161,6 +3161,15 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
|
||||||
type->ob_type->tp_name);
|
type->ob_type->tp_name);
|
||||||
goto raise_error;
|
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);
|
PyErr_Restore(type, value, tb);
|
||||||
if (tb == NULL)
|
if (tb == NULL)
|
||||||
return WHY_EXCEPTION;
|
return WHY_EXCEPTION;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue