diff options
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c index 7a28218..65366b0 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -378,7 +378,12 @@ PyObject_Repr(PyObject *v) Py_TYPE(v)->tp_name, v); else { PyObject *res; + /* It is possible for a type to have a tp_repr representation that + loops infinitely. */ + if (Py_EnterRecursiveCall(" while getting the repr of an object")) + return NULL; res = (*Py_TYPE(v)->tp_repr)(v); + Py_LeaveRecursiveCall(); if (res == NULL) return NULL; #ifdef Py_USING_UNICODE |