Skip to content

Commit f3cc5de

Browse files
committed
Fix TSAN list set failure
1 parent c379de2 commit f3cc5de

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Include/cpython/listobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ PyList_SET_ITEM(PyObject *op, Py_ssize_t index, PyObject *value) {
4444
PyListObject *list = _PyList_CAST(op);
4545
assert(0 <= index);
4646
assert(index < list->allocated);
47+
#ifdef Py_GIL_DISABLED
48+
_Py_atomic_store_ptr_release(&list->ob_item[index], value);
49+
#else
4750
list->ob_item[index] = value;
51+
#endif
4852
}
4953
#define PyList_SET_ITEM(op, index, value) \
5054
PyList_SET_ITEM(_PyObject_CAST(op), (index), _PyObject_CAST(value))

0 commit comments

Comments
 (0)