summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-11 00:33:07 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-04-11 00:33:07 (GMT)
commit0f1653e957cf519215af33dec61dc4808077bec2 (patch)
tree995e8e937d94dcd2abbeb26ffabd0bbad7c73e42
parentaa975432d4456c69e1b1fd2a335f01261175f798 (diff)
downloadcpython-0f1653e957cf519215af33dec61dc4808077bec2.zip
cpython-0f1653e957cf519215af33dec61dc4808077bec2.tar.gz
cpython-0f1653e957cf519215af33dec61dc4808077bec2.tar.bz2
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(()) (), (...)
-rw-r--r--Objects/tupleobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 56a1024..b68c80e 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;