mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
improved error message-- names the type of the unexpected object
This commit is contained in:
parent
69f086cbb6
commit
960d948e7c
1 changed files with 3 additions and 2 deletions
|
@ -2493,8 +2493,9 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
|
||||||
else {
|
else {
|
||||||
/* Not something you can raise. You get an exception
|
/* Not something you can raise. You get an exception
|
||||||
anyway, just not what you specified :-) */
|
anyway, just not what you specified :-) */
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_Format(PyExc_TypeError,
|
||||||
"exceptions must be strings, classes, or instances");
|
"exceptions must be strings, classes, or "
|
||||||
|
"instances, not %s", type->ob_type->tp_name);
|
||||||
goto raise_error;
|
goto raise_error;
|
||||||
}
|
}
|
||||||
PyErr_Restore(type, value, tb);
|
PyErr_Restore(type, value, tb);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue