summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_list.h
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@meta.com>2024-05-02 20:03:05 (GMT)
committerGitHub <noreply@github.com>2024-05-02 20:03:05 (GMT)
commit1e67b9207c31a92d76bfac09fc706c4dc703669e (patch)
tree5f6f4bee04d4168daf715f70ef307518ad956594 /Include/internal/pycore_list.h
parent8ed546679524140d8282175411fd141fe7df070d (diff)
downloadcpython-1e67b9207c31a92d76bfac09fc706c4dc703669e.zip
cpython-1e67b9207c31a92d76bfac09fc706c4dc703669e.tar.gz
cpython-1e67b9207c31a92d76bfac09fc706c4dc703669e.tar.bz2
gh-117657: Fix TSAN list set failure (#118260)
* Fix TSAN list set failure * Relaxed atomic is sufficient, add targetted test * More list * Remove atomic assign in list * Fixup white space
Diffstat (limited to 'Include/internal/pycore_list.h')
-rw-r--r--Include/internal/pycore_list.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/internal/pycore_list.h b/Include/internal/pycore_list.h
index 2a82912..73695d1 100644
--- a/Include/internal/pycore_list.h
+++ b/Include/internal/pycore_list.h
@@ -28,7 +28,11 @@ _PyList_AppendTakeRef(PyListObject *self, PyObject *newitem)
Py_ssize_t allocated = self->allocated;
assert((size_t)len + 1 < PY_SSIZE_T_MAX);
if (allocated > len) {
+#ifdef Py_GIL_DISABLED
+ _Py_atomic_store_ptr_release(&self->ob_item[len], newitem);
+#else
PyList_SET_ITEM(self, len, newitem);
+#endif
Py_SET_SIZE(self, len + 1);
return 0;
}