diff Python/ceval.c @ 21030:c7e833b3cd9c 2.1

backport of 2.242: improved error message-- names the type of the unexpected object
author Anthony Baxter <anthonybaxter@gmail.com>
date Wed, 21 Nov 2001 04:49:19 +0000
parents 325d513a50bb
children 65f4094f43f4
line wrap: on
line diff
--- a/Python/ceval.c	Wed Nov 21 03:51:20 2001 +0000
+++ b/Python/ceval.c	Wed Nov 21 04:49:19 2001 +0000
@@ -2470,8 +2470,9 @@
 	else {
 		/* Not something you can raise.  You get an exception
 		   anyway, just not what you specified :-) */
-		PyErr_SetString(PyExc_TypeError,
-		    "exceptions must be strings, classes, or instances");
+		PyErr_Format(PyExc_TypeError,
+			     "exceptions must be strings, classes, or "
+			     "instances, not %s", type->ob_type->tp_name);
 		goto raise_error;
 	}
 	PyErr_Restore(type, value, tb);