summaryrefslogtreecommitdiffstats
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@meta.com>2024-04-22 05:57:05 (GMT)
committerGitHub <noreply@github.com>2024-04-22 05:57:05 (GMT)
commit8b541c017ea92040add608b3e0ef8dc85e9e6060 (patch)
tree880ff7c97041f374d21197b1b486686f2d64c998 /Python/executor_cases.c.h
parent1446024124fb98c3051199760380685f8a2fd127 (diff)
downloadcpython-8b541c017ea92040add608b3e0ef8dc85e9e6060.zip
cpython-8b541c017ea92040add608b3e0ef8dc85e9e6060.tar.gz
cpython-8b541c017ea92040add608b3e0ef8dc85e9e6060.tar.bz2
gh-112075: Make instance attributes stored in inline "dict" thread safe (#114742)
Make instance attributes stored in inline "dict" thread safe on free-threaded builds
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index df87f91..841ce8c 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1998,8 +1998,7 @@
PyObject *owner;
owner = stack_pointer[-1];
assert(Py_TYPE(owner)->tp_flags & Py_TPFLAGS_MANAGED_DICT);
- PyManagedDictPointer *managed_dict = _PyObject_ManagedDictPointer(owner);
- PyDictObject *dict = managed_dict->dict;
+ PyDictObject *dict = _PyObject_GetManagedDict(owner);
if (dict == NULL) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
@@ -2015,8 +2014,7 @@
oparg = CURRENT_OPARG();
owner = stack_pointer[-1];
uint16_t hint = (uint16_t)CURRENT_OPERAND();
- PyManagedDictPointer *managed_dict = _PyObject_ManagedDictPointer(owner);
- PyDictObject *dict = managed_dict->dict;
+ PyDictObject *dict = _PyObject_GetManagedDict(owner);
if (hint >= (size_t)dict->ma_keys->dk_nentries) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
@@ -2159,7 +2157,7 @@
owner = stack_pointer[-1];
assert(Py_TYPE(owner)->tp_dictoffset < 0);
assert(Py_TYPE(owner)->tp_flags & Py_TPFLAGS_INLINE_VALUES);
- if (_PyObject_ManagedDictPointer(owner)->dict) {
+ if (_PyObject_GetManagedDict(owner)) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}
@@ -2177,7 +2175,7 @@
value = stack_pointer[-2];
uint16_t index = (uint16_t)CURRENT_OPERAND();
STAT_INC(STORE_ATTR, hit);
- assert(_PyObject_ManagedDictPointer(owner)->dict == NULL);
+ assert(_PyObject_GetManagedDict(owner) == NULL);
PyDictValues *values = _PyObject_InlineValues(owner);
PyObject *old_value = values->values[index];
values->values[index] = value;