diff options
author | Brett Cannon <bcannon@gmail.com> | 2006-03-01 04:25:17 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2006-03-01 04:25:17 (GMT) |
commit | bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8 (patch) | |
tree | 7456cf3d197d6f0dc017b0f851878bcaf6024f6c /Python/ceval.c | |
parent | 762467475d944f67ac20bf23c6c5144a6e39feae (diff) | |
download | cpython-bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8.zip cpython-bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8.tar.gz cpython-bf36409e2a8171b441d5e0a2f1c9e02d31a35ae8.tar.bz2 |
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.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 3ef853e..8d0f7e6 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1685,7 +1685,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throw) why == WHY_CONTINUE) retval = POP(); } - else if (PyClass_Check(v) || PyString_Check(v)) { + else if (PyExceptionClass_Check(v) || PyString_Check(v)) { w = POP(); u = POP(); PyErr_Restore(v, w, u); @@ -3026,14 +3026,14 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) /* Raising builtin string is deprecated but still allowed -- * do nothing. Raising an instance of a new-style str * subclass is right out. */ - if (-1 == PyErr_Warn(PyExc_PendingDeprecationWarning, + if (PyErr_Warn(PyExc_DeprecationWarning, "raising a string exception is deprecated")) goto raise_error; } - else if (PyClass_Check(type)) + else if (PyExceptionClass_Check(type)) PyErr_NormalizeException(&type, &value, &tb); - else if (PyInstance_Check(type)) { + else if (PyExceptionInstance_Check(type)) { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, @@ -3044,7 +3044,7 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb) /* Normalize to raise <class>, <instance> */ Py_DECREF(value); value = type; - type = (PyObject*) ((PyInstanceObject*)type)->in_class; + type = PyExceptionInstance_Class(type); Py_INCREF(type); } } |