Issue #19513: Simplify list_repr()

This commit is contained in:
Victor Stinner 2013-11-18 22:15:44 +01:00
parent 99b7b1c514
commit b8fb197aa0
1 changed files with 2 additions and 8 deletions

View 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;