Skip to content

Commit 492d513

Browse files
authored
Correctly compare the hint against the keys in _PyDict_GetItemHint (GH-22960)
1 parent 4a9c637 commit 492d513

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Objects/dictobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ _PyDict_GetItemHint(PyDictObject *mp, PyObject *key,
14481448
assert(PyDict_CheckExact((PyObject*)mp));
14491449
assert(PyUnicode_CheckExact(key));
14501450

1451-
if (hint >= 0 && hint < _PyDict_KeysSize(mp->ma_keys)) {
1451+
if (hint >= 0 && hint < mp->ma_keys->dk_nentries) {
14521452
PyObject *res = NULL;
14531453

14541454
PyDictKeyEntry *ep = DK_ENTRIES(mp->ma_keys) + (size_t)hint;

0 commit comments

Comments
 (0)