From: Jeremy Hylton Date: Fri, 27 Apr 2001 02:25:33 +0000 (+0000) Subject: improved error message-- names the type of the unexpected object X-Git-Tag: v2.2a3~1952 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=960d948e7ce536eb30b69add0c6fc2dc31c90a8e;p=thirdparty%2FPython%2Fcpython.git improved error message-- names the type of the unexpected object --- diff --git a/Python/ceval.c b/Python/ceval.c index d5e3a4e9a16d..df160f2cc35d 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);