https://github.com/python/cpython/commit/f3d877a27abca355f9d05decf3e2ce0874983288
commit: f3d877a27abca355f9d05decf3e2ce0874983288
branch: main
author: Kumar Aditya <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-04-18T15:06:27+05:30
summary:
gh-132643: use atomic load for dict in specializer (#132653)
files:
M Python/specialize.c
diff --git a/Python/specialize.c b/Python/specialize.c
index ceb396c5b54815..48cdcbd2a24cab 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -1641,7 +1641,8 @@ specialize_attr_loadclassattr(PyObject *owner,
_Py_CODEUNIT *instr,
specialize(instr, is_method ? LOAD_ATTR_METHOD_NO_DICT :
LOAD_ATTR_NONDESCRIPTOR_NO_DICT);
}
else if (is_method) {
- PyObject *dict = *(PyObject **) ((char *)owner + dictoffset);
+ PyObject **addr = (PyObject **)((char *)owner + dictoffset);
+ PyObject *dict = FT_ATOMIC_LOAD_PTR_ACQUIRE(*addr);
if (dict) {
SPECIALIZATION_FAIL(LOAD_ATTR,
SPEC_FAIL_ATTR_NOT_MANAGED_DICT);
return 0;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]