r58289 - python/trunk/Objects/tupleobject.c

Author: brett.cannon Date: Sun Sep 30 22:37:19 2007 New Revision: 58289 Modified: python/trunk/Objects/tupleobject.c Log: Fix error introduced by r58288; if a tuple is length 0 return its repr and don't worry about any self-referring tuples. Modified: python/trunk/Objects/tupleobject.c ============================================================================== --- python/trunk/Objects/tupleobject.c (original) +++ python/trunk/Objects/tupleobject.c Sun Sep 30 22:37:19 2007 @@ -216,6 +216,10 @@ PyObject *s, *temp; PyObject *pieces, *result = NULL; + n = Py_Size(v); + if (n == 0) + return PyString_FromString("()"); + /* While not mutable, it is still possible to end up with a cycle in a tuple through an object that stores itself within a tuple (and thus infinitely asks for the repr of itself). This should only be @@ -225,10 +229,6 @@ return i > 0 ? PyString_FromString("(...)") : NULL; } - n = Py_Size(v); - if (n == 0) - return PyString_FromString("()"); - pieces = PyTuple_New(n); if (pieces == NULL) return NULL;
participants (1)
-
brett.cannon