]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport Tim's checkin 2.247:
authorThomas Wouters <thomas@python.org>
Wed, 27 Jun 2001 14:13:32 +0000 (14:13 +0000)
committerThomas Wouters <thomas@python.org>
Wed, 27 Jun 2001 14:13:32 +0000 (14:13 +0000)
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.

Python/ceval.c

index 64dbf983c8aa7e217e593bc01043bc9911397827..690c6535724970f7e1361338635faddf8f88dec9 100644 (file)
@@ -2812,8 +2812,9 @@ call_object(PyObject *func, PyObject *arg, PyObject *kw)
        else if ((call = func->ob_type->tp_call) != NULL)
                result = (*call)(func, arg, kw);
        else {
-               PyErr_Format(PyExc_TypeError, "object is not callable: %s",
-                            PyString_AS_STRING(PyObject_Repr(func)));
+               PyErr_Format(PyExc_TypeError,
+                            "object of type '%.100s' is not callable",
+                            func->ob_type->tp_name);
                return NULL;
        }
         if (result == NULL && !PyErr_Occurred())