Skip to content

Commit d194de0

Browse files
committed
Correctly compare the hint against the size in _PyDict_GetItemHint
1 parent 345cd37 commit d194de0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)