mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
SF bug 433228: repr(list) woes when len(list) big
call_object: If the object isn't callable, display its type in the error msg rather than its repr. Bugfix candidate.
This commit is contained in:
parent
57e52ef076
commit
239508cd10
1 changed files with 3 additions and 2 deletions
|
@ -2862,8 +2862,9 @@ call_object(PyObject *func, PyObject *arg, PyObject *kw)
|
||||||
else if ((call = func->ob_type->tp_call) != NULL)
|
else if ((call = func->ob_type->tp_call) != NULL)
|
||||||
result = (*call)(func, arg, kw);
|
result = (*call)(func, arg, kw);
|
||||||
else {
|
else {
|
||||||
PyErr_Format(PyExc_TypeError, "object is not callable: %s",
|
PyErr_Format(PyExc_TypeError,
|
||||||
PyString_AS_STRING(PyObject_Repr(func)));
|
"object of type '%.100s' is not callable",
|
||||||
|
func->ob_type->tp_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (result == NULL && !PyErr_Occurred())
|
if (result == NULL && !PyErr_Occurred())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue