https://github.com/python/cpython/commit/00ea77613b942a9e08df6e3eb74b2ccd37641ba6
commit: 00ea77613b942a9e08df6e3eb74b2ccd37641ba6
branch: main
author: Kumar Aditya <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-05-18T22:08:37+05:30
summary:
gh-149816: fix thread safety of deletion of list slice (#149936)
files:
M Objects/listobject.c
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 10e25bbdcdcb6c..c76721c5d2ac9e 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -3793,16 +3793,13 @@ list_ass_subscript_lock_held(PyObject *_self, PyObject
*item, PyObject *value)
lim = Py_SIZE(self) - cur - 1;
}
- memmove(self->ob_item + cur - i,
- self->ob_item + cur + 1,
- lim * sizeof(PyObject *));
+ ptr_wise_atomic_memmove(self, self->ob_item + cur - i,
+ self->ob_item + cur + 1, lim);
}
cur = start + (size_t)slicelength * step;
if (cur < (size_t)Py_SIZE(self)) {
- memmove(self->ob_item + cur - slicelength,
- self->ob_item + cur,
- (Py_SIZE(self) - cur) *
- sizeof(PyObject *));
+ ptr_wise_atomic_memmove(self, self->ob_item + cur -
slicelength,
+ self->ob_item + cur, Py_SIZE(self) - cur);
}
Py_SET_SIZE(self, Py_SIZE(self) - slicelength);
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]