diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-04-27 02:25:33 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-04-27 02:25:33 (GMT) |
commit | 960d948e7ce536eb30b69add0c6fc2dc31c90a8e (patch) | |
tree | 45cfb0ecb3526d280d91de2301f77c82e6e880a6 /Python | |
parent | 69f086cbb675b6119a24a8b9f070c61218ccda1a (diff) | |
download | cpython-960d948e7ce536eb30b69add0c6fc2dc31c90a8e.zip cpython-960d948e7ce536eb30b69add0c6fc2dc31c90a8e.tar.gz cpython-960d948e7ce536eb30b69add0c6fc2dc31c90a8e.tar.bz2 |
improved error message-- names the type of the unexpected object
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d5e3a4e..df160f2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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); |