Skip to content

Commit f3d877a

Browse files
gh-132643: use atomic load for dict in specializer (#132653)
1 parent 80295a8 commit f3d877a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: Python/specialize.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,8 @@ specialize_attr_loadclassattr(PyObject *owner, _Py_CODEUNIT *instr,
16411641
specialize(instr, is_method ? LOAD_ATTR_METHOD_NO_DICT : LOAD_ATTR_NONDESCRIPTOR_NO_DICT);
16421642
}
16431643
else if (is_method) {
1644-
PyObject *dict = *(PyObject **) ((char *)owner + dictoffset);
1644+
PyObject **addr = (PyObject **)((char *)owner + dictoffset);
1645+
PyObject *dict = FT_ATOMIC_LOAD_PTR_ACQUIRE(*addr);
16451646
if (dict) {
16461647
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_NOT_MANAGED_DICT);
16471648
return 0;

0 commit comments

Comments
 (0)