Skip to content

Commit a74c0ee

Browse files
committed
Remove splitdict_lookup_keys_lock_held
1 parent e7d7430 commit a74c0ee

File tree

1 file changed

+6
-36
lines changed

1 file changed

+6
-36
lines changed

Objects/dictobject.c

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,41 +1188,10 @@ _PyDictKeys_StringLookup(PyDictKeysObject* dk, PyObject *key)
11881188
return unicodekeys_lookup_unicode(dk, key, hash);
11891189
}
11901190

1191-
1192-
#ifdef Py_GIL_DISABLED
1193-
1194-
// Version of _Py_dict_lookup specialized for when we have split keys and the
1195-
// shared keys are locked.
1196-
static Py_ssize_t
1197-
splitdict_lookup_keys_lock_held(PyDictObject *mp, PyObject *key, Py_hash_t hash,
1198-
PyObject **value_addr)
1199-
{
1200-
PyDictKeysObject *dk = mp->ma_keys;
1201-
Py_ssize_t ix;
1202-
1203-
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(mp);
1204-
ASSERT_KEYS_LOCKED(dk);
1205-
assert(PyUnicode_CheckExact(key));
1206-
assert(dk->dk_kind == DICT_KEYS_SPLIT);
1207-
1208-
ix = unicodekeys_lookup_unicode(dk, key, hash);
1209-
1210-
if (ix >= 0) {
1211-
*value_addr = mp->ma_values->values[ix];
1212-
}
1213-
else {
1214-
*value_addr = NULL;
1215-
}
1216-
1217-
return ix;
1218-
}
1219-
12201191
static Py_ssize_t
12211192
unicodekeys_lookup_unicode_threadsafe(PyDictKeysObject* dk, PyObject *key,
12221193
Py_hash_t hash);
12231194

1224-
#endif // Py_GIL_DISABLED
1225-
12261195
/*
12271196
The basic lookup function used by all operations.
12281197
This is based on Algorithm D from Knuth Vol. 3, Sec. 6.4.
@@ -1260,15 +1229,16 @@ _Py_dict_lookup(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **valu
12601229
ix = unicodekeys_lookup_unicode_threadsafe(dk, key, hash);
12611230
if (ix == DKIX_KEY_CHANGED) {
12621231
LOCK_KEYS(dk);
1263-
ix = splitdict_lookup_keys_lock_held(mp, key, hash,
1264-
value_addr);
1232+
ix = unicodekeys_lookup_unicode(dk, key, hash);
12651233
UNLOCK_KEYS(dk);
1266-
return ix;
12671234
}
12681235
}
1269-
#endif
1270-
1236+
else {
1237+
ix = unicodekeys_lookup_unicode(dk, key, hash);
1238+
}
1239+
#else
12711240
ix = unicodekeys_lookup_unicode(dk, key, hash);
1241+
#endif
12721242
}
12731243
else {
12741244
INCREF_KEYS_FT(dk);

0 commit comments

Comments
 (0)