summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-18 21:15:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-18 21:15:44 (GMT)
commitb8fb197aa018f518470b1bfc4e2861bc737c1964 (patch)
tree203166c6f8680d6d2181c49b6771b3ceff18c038
parent99b7b1c51470bd7e8ed1d54316d8bfb1c72f984b (diff)
downloadcpython-b8fb197aa018f518470b1bfc4e2861bc737c1964.zip
cpython-b8fb197aa018f518470b1bfc4e2861bc737c1964.tar.gz
cpython-b8fb197aa018f518470b1bfc4e2861bc737c1964.tar.bz2
Issue #19513: Simplify list_repr()
-rw-r--r--Objects/listobject.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 5e40667..50538e1 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;