Skip to content

Commit 5ea60dd

Browse files
use atomic store in PyObject_GenericSetDict
1 parent 0eb448c commit 5ea60dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/object.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,9 @@ PyObject_GenericSetDict(PyObject *obj, PyObject *value, void *context)
19311931
return -1;
19321932
}
19331933
Py_BEGIN_CRITICAL_SECTION(obj);
1934-
Py_XSETREF(*dictptr, Py_NewRef(value));
1934+
PyObject *olddict = *dictptr;
1935+
FT_ATOMIC_STORE_PTR_RELEASE(*dictptr, Py_NewRef(value));
1936+
Py_XDECREF(olddict);
19351937
Py_END_CRITICAL_SECTION();
19361938
return 0;
19371939
}

0 commit comments

Comments
 (0)