Skip to content

Commit 44c3679

Browse files
committed
Backport Tim's checkin 2.247:
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.
1 parent 5eaa740 commit 44c3679

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
@@ -2812,8 +2812,9 @@ call_object(PyObject *func, PyObject *arg, PyObject *kw)
28122812
else if ((call = func->ob_type->tp_call) != NULL)
28132813
result = (*call)(func, arg, kw);
28142814
else {
2815-
PyErr_Format(PyExc_TypeError, "object is not callable: %s",
2816-
PyString_AS_STRING(PyObject_Repr(func)));
2815+
PyErr_Format(PyExc_TypeError,
2816+
"object of type '%.100s' is not callable",
2817+
func->ob_type->tp_name);
28172818
return NULL;
28182819
}
28192820
if (result == NULL && !PyErr_Occurred())

0 commit comments

Comments
 (0)