[Python-checkins] r62284 - python/branches/release25-maint/Objects/tupleobject.c

amaury.forgeotdarc python-checkins at python.org
Fri Apr 11 02:33:08 CEST 2008


Author: amaury.forgeotdarc
Date: Fri Apr 11 02:33:07 2008
New Revision: 62284

Modified:
   python/branches/release25-maint/Objects/tupleobject.c
Log:
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(())
   (), (...)


Modified: python/branches/release25-maint/Objects/tupleobject.c
==============================================================================
--- python/branches/release25-maint/Objects/tupleobject.c	(original)
+++ python/branches/release25-maint/Objects/tupleobject.c	Fri Apr 11 02:33:07 2008
@@ -208,6 +208,10 @@
 	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 @@
 		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;


More information about the Python-checkins mailing list