From: Guido van Rossum Date: Tue, 25 Aug 1998 18:16:54 +0000 (+0000) Subject: Add the type of the object to the error message about calling a non-function. X-Git-Tag: v1.5.2a2~345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d1ad39b8137e31c1ba80f85e264a0c450c7ef26;p=python Add the type of the object to the error message about calling a non-function. --- diff --git a/Python/ceval.c b/Python/ceval.c index ff5ee509f6..0178f84498 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2369,7 +2369,8 @@ call_builtin(func, arg, kw) Py_DECREF(call); return res; } - PyErr_SetString(PyExc_TypeError, "call of non-function"); + PyErr_Format(PyExc_TypeError, "call of non-function (type %s)", + func->ob_type->tp_name); return NULL; } @@ -2438,8 +2439,9 @@ call_function(func, arg, kw) } else { if (!PyFunction_Check(func)) { - PyErr_SetString(PyExc_TypeError, - "call of non-function"); + PyErr_Format(PyExc_TypeError, + "call of non-function (type %s)", + func->ob_type->tp_name); return NULL; } Py_INCREF(arg);