Skip to content

Commit

Permalink
Add the type of the object to the error message about calling a non-f…
Browse files Browse the repository at this point in the history
…unction.
  • Loading branch information
gvanrossum committed Aug 25, 1998
1 parent 6e73bf4 commit 2d1ad39
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2d1ad39

Please sign in to comment.