You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyList_SetItem currently uses Py_XSETREF to set the item and decref the old one, however the store is not atomic as such it can race with a concurrent read. The fix is to use a atomic store with release order to correctly set the new item and then decref the old object.
Activity
colesbury commentedon Feb 4, 2025
There is a similar issue in the function
ins1:cpython/Objects/listobject.c
Lines 467 to 470 in 979d766
gh-129643: fix thread safety of `PyList_SetItem` (#129644)
pythongh-129643: fix thread safety of `PyList_SetItem` (python#129644)
[3.13] gh-129643: fix thread safety of `PyList_SetItem` (#129644) (#1…
pythongh-129643: Fix `PyList_Insert` in free-threading builds
gh-129643: Fix `PyList_Insert` in free-threading builds (#129680)
[3.13] pythongh-129643: Fix `PyList_Insert` in free-threading builds (p…
[3.13] gh-129643: Fix `PyList_Insert` in free-threading builds (GH-12…
pythongh-129643: fix thread safety of `PyList_SetItem` (python#129644)
pythongh-129643: Fix `PyList_Insert` in free-threading builds (python…
pythongh-129643: fix thread safety of `PyList_SetItem` (python#129644)
pythongh-129643: Fix `PyList_Insert` in free-threading builds (python…