8000 gh-112075: Make PyDictKeysObject thread-safe by DinoV · Pull Request #114741 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-112075: Make PyDictKeysObject thread-safe #114741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix naming of unsplit -> combined
  • Loading branch information
DinoV committed Feb 20, 2024
commit 18d29166d564365166b6a0db81f5d0622bae2b3d
8 changes: 4 additions & 4 deletions Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ insert_into_dictkeys(PyDictKeysObject *keys, PyObject *name)


static inline int
insert_unsplit_dict(PyInterpreterState *interp, PyDictObject *mp,
insert_combined_dict(PyInterpreterState *interp, PyDictObject *mp,
Py_hash_t hash, PyObject *key, PyObject *value, int unicode)
{
if (mp->ma_keys->dk_usable <= 0) {
Expand Down Expand Up @@ -1325,7 +1325,7 @@ insert_split_dict(PyInterpreterState *interp, PyDictObject *mp,
assert(!_PyDict_HasSplitTable(mp));
assert(DK_IS_UNICODE(keys));
UNLOCK_KEYS(keys);
return insert_unsplit_dict(interp, mp, hash, key, value, 1);
return insert_combined_dict(interp, mp, hash, key, value, 1);
}

Py_ssize_t hashpos = find_empty_slot(keys, hash);
Expand Down Expand Up @@ -1406,7 +1406,7 @@ insertdict(PyInterpreterState *interp, PyDictObject *mp,

int uni 8592 code = DK_IS_UNICODE(mp->ma_keys);
if (!unicode || !_PyDict_HasSplitTable(mp)) {
if (insert_unsplit_dict(interp, mp, hash, key, value, unicode) < 0) {
if (insert_combined_dict(interp, mp, hash, key, value, unicode) < 0) {
goto Fail;
}
} else {
Expand Down Expand Up @@ -3819,7 +3819,7 @@ dict_setdefault_ref_lock_held(PyObject *d, PyObject *key, PyObject *default_valu

int unicode = DK_IS_UNICODE(mp->ma_keys);
if (!unicode || !_PyDict_HasSplitTable(mp)) {
if (insert_unsplit_dict(interp, mp, hash, Py_NewRef(key), Py_NewRef(value), unicode) < 0) {
if (insert_combined_dict(interp, mp, hash, Py_NewRef(key), Py_NewRef(value), unicode) < 0) {
Py_DECREF(key);
Py_DECREF(value);
if (result) {
Expand Down
0