summaryrefslogtreecommitdiff
path: root/Objects/tupleobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r--Objects/tupleobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 56a1024fa1..b68c80e4a2 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;