mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-106168: Revert the "size before item" setting (#111683)
gh-106168: Update the size only after setting the item, to avoid temporary inconsistencies. Also remove the "what's new" sentence regarding the size setting since tuples cannot grow after allocation.
This commit is contained in:
parent
d49aba5a7a
commit
24ddaee5ca
3 changed files with 2 additions and 4 deletions
|
|
@ -956,8 +956,8 @@ list_extend(PyListObject *self, PyObject *iterable)
|
|||
if (Py_SIZE(self) < self->allocated) {
|
||||
/* steals ref */
|
||||
Py_ssize_t len = Py_SIZE(self);
|
||||
Py_SET_SIZE(self, len + 1);
|
||||
PyList_SET_ITEM(self, len, item);
|
||||
Py_SET_SIZE(self, len + 1);
|
||||
}
|
||||
else {
|
||||
if (_PyList_AppendTakeRef(self, item) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue