diff Python/codecs.c @ 36751:8e04de2480e4 legacy-trunk

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.
author Brett Cannon <bcannon@gmail.com>
date Wed, 01 Mar 2006 04:25:17 +0000
parents 5c36c222e7ca
children 7fa4c29d7030
line wrap: on
line diff
--- a/Python/codecs.c	Wed Mar 01 04:06:10 2006 +0000
+++ b/Python/codecs.c	Wed Mar 01 04:25:17 2006 +0000
@@ -448,9 +448,8 @@
 
 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;