Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 239508c

Browse files
committed
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.
1 parent 57e52ef commit 239508c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Python/ceval.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,8 +2862,9 @@ call_object(PyObject *func, PyObject *arg, PyObject *kw)
28622862
else if ((call = func->ob_type->tp_call) != NULL)
28632863
result = (*call)(func, arg, kw);
28642864
else {
2865-
PyErr_Format(PyExc_TypeError, "object is not callable: %s",
2866-
PyString_AS_STRING(PyObject_Repr(func)));
2865+
PyErr_Format(PyExc_TypeError,
2866+
"object of type '%.100s' is not callable",
2867+
func->ob_type->tp_name);
28672868
return NULL;
28682869
}
28692870
if (result == NULL && !PyErr_Occurred())

0 commit comments

Comments
 (0)