Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed scalability issue in free-threaded builds for lock-free reads from dictionaries in multi-threaded scenarios
6 changes: 3 additions & 3 deletions Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ _Py_dict_lookup_threadsafe(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyOb
*value_addr = value;
if (value != NULL) {
assert(ix >= 0);
Py_INCREF(value);
_Py_NewRefWithLock(value);
}
Py_END_CRITICAL_SECTION();
return ix;
Expand Down Expand Up @@ -6988,7 +6988,7 @@ _PyObject_TryGetInstanceAttribute(PyObject *obj, PyObject *name, PyObject **attr
// Still no dict, we can read from the values
assert(values->valid);
value = values->values[ix];
*attr = Py_XNewRef(value);
*attr = _Py_XNewRefWithLock(value);
success = true;
}

Expand All @@ -7008,7 +7008,7 @@ _PyObject_TryGetInstanceAttribute(PyObject *obj, PyObject *name, PyObject **attr

if (dict->ma_values == values && FT_ATOMIC_LOAD_UINT8(values->valid)) {
value = _Py_atomic_load_ptr_relaxed(&values->values[ix]);
*attr = Py_XNewRef(value);
*attr = _Py_XNewRefWithLock(value);
success = true;
} else {
// Caller needs to lookup from the dictionary
Expand Down
Loading