From: Anthony Baxter Date: Wed, 21 Nov 2001 04:49:19 +0000 (+0000) Subject: backport of 2.242: X-Git-Tag: v2.1.2c1~77 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b78e593e491a41dc9c45ad46d3be2c977f52fd1c;p=thirdparty%2FPython%2Fcpython.git backport of 2.242: improved error message-- names the type of the unexpected object --- diff --git a/Python/ceval.c b/Python/ceval.c index ccab1585679b..72e4b6b7d697 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2470,8 +2470,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);