8000 Remove splitdict_lookup_keys_lock_held · python/cpython@19d1446 · GitHub
[go: up one dir, main page]

Skip to content

Commit 19d1446

Browse files
committed
Remove splitdict_lookup_keys_lock_held
1 parent cca4ab3 commit 19d1446

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
@@ -1187,41 +1187,10 @@ _PyDictKeys_StringLookup(PyDictKeysObject* dk, PyObject *key)
11871187
return unicodekeys_lookup_unicode(dk, key, hash);
11881188
}
11891189

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

1223-
#endif // Py_GIL_DISABLED
1224-
12251194
/*
12261195
The basic lookup function used by all operations.
12271196
This is based on Algorithm D from Knuth Vol. 3, Sec. 6.4.
@@ -1259,15 +1228,16 @@ _Py_dict_lookup(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **valu
12591228
ix = unicodekeys_lookup_unicode_threadsafe(dk, key, hash);
12601229
if (ix == DKIX_KEY_CHANGED) {
12611230
LOCK_KEYS(dk);
1262-
ix = splitdict_lookup_keys_lock_held(mp, key, hash,
1263-
value_addr);
1231+
ix = unicodekeys_lookup_unicode(dk, key, hash);
12641232
UNLOCK_KEYS(dk);
1265-
return ix;
12661233
}
12671234
}
1268-
#endif
1269-
1235+
else {
1236+
ix = unicodekeys_lookup_unicode(dk, key, hash);
1237+
}
1238+
#else
12701239
ix = unicodekeys_lookup_unicode(dk, key, hash);
1240+
#endif
12711241
}
12721242
else {
12731243
INCREF_KEYS_FT(dk);

0 commit comments

Comments
 (0)
0