mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
PEP 352 implementation. Creates a new base class, BaseException, which has an
added message attribute compared to the previous version of Exception. It is also a new-style class, making all exceptions now new-style. KeyboardInterrupt and SystemExit inherit from BaseException directly. String exceptions now raise DeprecationWarning. Applies patch 1104669, and closes bugs 1012952 and 518846.
This commit is contained in:
parent
762467475d
commit
bf36409e2a
16 changed files with 570 additions and 232 deletions
|
@ -448,9 +448,8 @@ static void wrong_exception_type(PyObject *exc)
|
|||
|
||||
PyObject *PyCodec_StrictErrors(PyObject *exc)
|
||||
{
|
||||
if (PyInstance_Check(exc))
|
||||
PyErr_SetObject((PyObject*)((PyInstanceObject*)exc)->in_class,
|
||||
exc);
|
||||
if (PyExceptionInstance_Check(exc))
|
||||
PyErr_SetObject(PyExceptionInstance_Class(exc), exc);
|
||||
else
|
||||
PyErr_SetString(PyExc_TypeError, "codec must pass exception instance");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue