Commit b8fb197a authored by Victor Stinner's avatar Victor Stinner

Issue #19513: Simplify list_repr()

parent 99b7b1c5
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment