Visitar URL original
gh-158592: Reallocate the list's array when deleting by index by x42005e1f · Pull Request #158602 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-158592: Reallocate the list's array when deleting by index
  • Loading branch information
x42005e1f committed Oct 2, 2026
commit e7e439bd1dbc9fa5fea983358f7581c588045b73
2 changes: 1 addition & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ list_ass_item_lock_held(PyListObject *a, Py_ssize_t i, PyObject *v)
for (Py_ssize_t idx = i; idx < size - 1; idx++) {
FT_ATOMIC_STORE_PTR_RELEASE(a->ob_item[idx], a->ob_item[idx + 1]);
}
Py_SET_SIZE(a, size - 1);
list_resize(a, size - 1); // NB: shrinking a list can't fail
}
else {
FT_ATOMIC_STORE_PTR_RELEASE(a->ob_item[i], Py_NewRef(v));
Expand Down