]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
improved error message-- names the type of the unexpected object
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 27 Apr 2001 02:25:33 +0000 (02:25 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 27 Apr 2001 02:25:33 +0000 (02:25 +0000)
Python/ceval.c

index d5e3a4e9a16d608326c7eac34a3ac8f238f056d7..df160f2cc35da86b1e90cfc6a9e60a4bdcf19d02 100644 (file)
@@ -2493,8 +2493,9 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
        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);