diff -r e8b8279ca118 Objects/dictobject.c --- a/Objects/dictobject.c Sun Jul 21 21:57:52 2013 -0400 +++ b/Objects/dictobject.c Mon Jul 22 22:35:49 2013 +0100 @@ -2913,20 +2913,30 @@ PyObject *seq; PyObject *seq_str; PyObject *result; + Py_ssize_t rc; + + rc = Py_ReprEnter((PyObject *)dv); + if (rc != 0) + return rc > 0 ? PyString_FromString("...") : NULL; seq = PySequence_List((PyObject *)dv); - if (seq == NULL) - return NULL; + if (seq == NULL) { + result = NULL; + goto Done; + } seq_str = PyObject_Repr(seq); if (seq_str == NULL) { - Py_DECREF(seq); - return NULL; + result = NULL; + goto Done_seq; } result = PyString_FromFormat("%s(%s)", Py_TYPE(dv)->tp_name, PyString_AS_STRING(seq_str)); Py_DECREF(seq_str); +Done_seq: Py_DECREF(seq); +Done: + Py_ReprLeave((PyObject *)dv); return result; }