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(())
   (), (...)
This commit is contained in:
Amaury Forgeot d'Arc 2008-04-11 00:33:07 +00:00
parent aa975432d4
commit 0f1653e957
1 changed files with 4 additions and 4 deletions

View File

@ -208,6 +208,10 @@ tuplerepr(PyTupleObject *v)
PyObject *s, *temp; PyObject *s, *temp;
PyObject *pieces, *result = NULL; 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 /* 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 tuple through an object that stores itself within a tuple (and thus
infinitely asks for the repr of itself). This should only be infinitely asks for the repr of itself). This should only be
@ -217,10 +221,6 @@ tuplerepr(PyTupleObject *v)
return i > 0 ? PyString_FromString("(...)") : NULL; return i > 0 ? PyString_FromString("(...)") : NULL;
} }
n = v->ob_size;
if (n == 0)
return PyString_FromString("()");
pieces = PyTuple_New(n); pieces = PyTuple_New(n);
if (pieces == NULL) if (pieces == NULL)
return NULL; return NULL;