mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #19513: Simplify list_repr()
This commit is contained in:
parent
99b7b1c514
commit
b8fb197aa0
1 changed files with 2 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue