From: Victor Stinner Date: Mon, 18 Nov 2013 21:15:44 +0000 (+0100) Subject: Issue #19513: Simplify list_repr() X-Git-Tag: v3.4.0b1~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b8fb197aa018f518470b1bfc4e2861bc737c1964;p=thirdparty%2FPython%2Fcpython.git Issue #19513: Simplify list_repr() --- diff --git a/Objects/listobject.c b/Objects/listobject.c index 5e40667239e0..50538e178a4e 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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;