https://github.com/python/cpython/commit/0b92f01c59c82a111bb6b9929fbfc0f9cb1241db
commit: 0b92f01c59c82a111bb6b9929fbfc0f9cb1241db
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-05-19T10:11:43+05:30
summary:

[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 <[email protected]>

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]

Reply via email to