diff Python/errors.c @ 40955:2ce229a7ba3f 2.5

Fix SF bug #1669182. Handle string exceptions even if unraisable (ie in __del__).
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 26 Feb 2007 23:46:51 +0000
parents ca295c270b1c
children 787b969d37f0
line wrap: on
line diff
--- a/Python/errors.c	Mon Feb 26 23:03:03 2007 +0000
+++ b/Python/errors.c	Mon Feb 26 23:46:51 2007 +0000
@@ -590,7 +590,11 @@
 		PyFile_WriteString("Exception ", f);
 		if (t) {
 			PyObject* moduleName;
-			char* className = PyExceptionClass_Name(t);
+			char* className = NULL;
+			if (PyExceptionClass_Check(t))
+				className = PyExceptionClass_Name(t);
+			else if (PyString_Check(t))
+				className = PyString_AS_STRING(t);
 
 			if (className != NULL) {
 				char *dot = strrchr(className, '.');