Commit 960d948e authored by Jeremy Hylton's avatar Jeremy Hylton

improved error message-- names the type of the unexpected object

parent 69f086cb
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment