From: Amaury Forgeot d'Arc Date: Fri, 11 Apr 2008 00:33:07 +0000 (+0000) Subject: Correct previous checkin, probably a svn merge issue. X-Git-Tag: v2.5.3c1~105 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f1653e957cf519215af33dec61dc4808077bec2;p=thirdparty%2FPython%2Fcpython.git Correct previous checkin, probably a svn merge issue. Now the code is similar to the one in trunk/. The behavior was funny: >>> print (), repr(()) (), () >>> print (), repr(()) (), (...) --- diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 56a1024fa1d2..b68c80e4a2cb 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -208,6 +208,10 @@ tuplerepr(PyTupleObject *v) PyObject *s, *temp; PyObject *pieces, *result = NULL; + n = v->ob_size; + 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 @@ -217,10 +221,6 @@ tuplerepr(PyTupleObject *v) return i > 0 ? PyString_FromString("(...)") : NULL; } - n = v->ob_size; - if (n == 0) - return PyString_FromString("()"); - pieces = PyTuple_New(n); if (pieces == NULL) return NULL;