summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2006-03-01 04:25:17 (GMT)
committerBrett Cannon <bcannon@gmail.com>2006-03-01 04:25:17 (GMT)
commitbf36409e2a8171b441d5e0a2f1c9e02d31a35ae8 (patch)
tree7456cf3d197d6f0dc017b0f851878bcaf6024f6c /Objects
parent762467475d944f67ac20bf23c6c5144a6e39feae (diff)
downloadcpython-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 'Objects')
-rw-r--r--Objects/genobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 8b84e2e..c24c3ce 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -230,11 +230,11 @@ gen_throw(PyGenObject *gen, PyObject *args)
Py_XINCREF(val);
Py_XINCREF(tb);
- if (PyClass_Check(typ)) {
+ if (PyExceptionClass_Check(typ)) {
PyErr_NormalizeException(&typ, &val, &tb);
}
- else if (PyInstance_Check(typ)) {
+ else if (PyExceptionInstance_Check(typ)) {
/* Raising an instance. The value should be a dummy. */
if (val && val != Py_None) {
PyErr_SetString(PyExc_TypeError,
@@ -245,7 +245,7 @@ gen_throw(PyGenObject *gen, PyObject *args)
/* Normalize to raise <class>, <instance> */
Py_XDECREF(val);
val = typ;
- typ = (PyObject*) ((PyInstanceObject*)typ)->in_class;
+ typ = PyExceptionInstance_Class(typ);
Py_INCREF(typ);
}
}