gh-152951 - Fix double DECREF when newblock fails during deque.extend calls (#152961)

This commit is contained in:
Steve Stagg
2026-07-03 18:43:24 +01:00
committed by GitHub
parent 1b4135a2c6
commit a90576d72c
2 changed files with 2 additions and 1 deletions
@@ -0,0 +1,2 @@
:class:`collections.deque` prevent rare crash when calling ``extend`` under
high memory pressure conditions.
-1
View File
@@ -512,7 +512,6 @@ deque_extend_impl(dequeobject *deque, PyObject *iterable)
iternext = *Py_TYPE(it)->tp_iternext;
while ((item = iternext(it)) != NULL) {
if (deque_append_lock_held(deque, item, maxlen) == -1) {
Py_DECREF(item);
Py_DECREF(it);
return NULL;
}