From 00ea77613b942a9e08df6e3eb74b2ccd37641ba6 Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Mon, 18 May 2026 22:08:37 +0530 Subject: [PATCH] gh-149816: fix thread safety of deletion of list slice (#149936) --- Objects/listobject.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Objects/listobject.c b/Objects/listobject.c index 10e25bbdcdcb..c76721c5d2ac 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); -- 2.47.3