From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 19 May 2026 04:41:43 +0000 (+0200) Subject: [3.15] gh-149816: fix thread safety of deletion of list slice (GH-149936) (#150003) X-Git-Tag: v3.15.0b2~127 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=0b92f01c59c82a111bb6b9929fbfc0f9cb1241db;p=thirdparty%2FPython%2Fcpython.git [3.15] gh-149816: fix thread safety of deletion of list slice (GH-149936) (#150003) gh-149816: fix thread safety of deletion of list slice (GH-149936) (cherry picked from commit 00ea77613b942a9e08df6e3eb74b2ccd37641ba6) Co-authored-by: Kumar Aditya --- 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);