Add the type of the object to the error message about calling a non-function.

This commit is contained in:
Guido van Rossum 1998-08-25 18:16:54 +00:00
parent 6e73bf4032
commit 2d1ad39b81
1 changed files with 5 additions and 3 deletions

View File

@ -2369,7 +2369,8 @@ call_builtin(func, arg, kw)
Py_DECREF(call); Py_DECREF(call);
return res; 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; return NULL;
} }
@ -2438,8 +2439,9 @@ call_function(func, arg, kw)
} }
else { else {
if (!PyFunction_Check(func)) { if (!PyFunction_Check(func)) {
PyErr_SetString(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"call of non-function"); "call of non-function (type %s)",
func->ob_type->tp_name);
return NULL; return NULL;
} }
Py_INCREF(arg); Py_INCREF(arg);