8000 bpo-39829: __len__() called twice when constructing a list · python/cpython@75ec222 · GitHub
[go: up one dir, main page]

Skip to content

Commit 75ec222

Browse files
bpo-39829: __len__() called twice when constructing a list
1 parent 1f706b4 commit 75ec222

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Objects/listobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ list_extend(PyListObject *self, PyObject *iterable)
933933
* eventually run out of memory during the loop.
934934
*/
935935
}
936-
else if (self->ob_item == NULL) {
936+
else if (n && self->ob_item == NULL) {
937937
if (list_preallocate_exact(self, n) < 0)
938938
goto error;
939939
}

0 commit comments

Comments
 (0)
0