]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #19513: Simplify list_repr()
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 18 Nov 2013 21:15:44 +0000 (22:15 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 18 Nov 2013 21:15:44 +0000 (22:15 +0100)
Objects/listobject.c

index 5e40667239e033fdb97ca19b5189b216d7eab50e..50538e178a4efc93560ca0ec31e365c39eaa51bf 100644 (file)
@@ -359,14 +359,8 @@ list_repr(PyListObject *v)
 
     _PyUnicodeWriter_Init(&writer);
     writer.overallocate = 1;
-    if (Py_SIZE(v) > 1) {
-        /* "[" + "1" + ", 2" * (len - 1) + "]" */
-        writer.min_length = 1 + 1 + (2 + 1) * (Py_SIZE(v) - 1) + 1;
-    }
-    else {
-        /* "[1]" */
-        writer.min_length = 3;
-    }
+    /* "[" + "1" + ", 2" * (len - 1) + "]" */
+    writer.min_length = 1 + 1 + (2 + 1) * (Py_SIZE(v) - 1) + 1;
 
     if (_PyUnicodeWriter_WriteChar(&writer, '[') < 0)
         goto error;