From d194de0995b5647105d7bbf5567fba3fc940d36b Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sun, 25 Oct 2020 05:23:33 +0000 Subject: [PATCH] Correctly compare the hint against the size in _PyDict_GetItemHint --- Objects/dictobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 8e7496234528684..42d71e56d4547ca 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1448,7 +1448,7 @@ _PyDict_GetItemHint(PyDictObject *mp, PyObject *key, assert(PyDict_CheckExact((PyObject*)mp)); assert(PyUnicode_CheckExact(key)); - if (hint >= 0 && hint < _PyDict_KeysSize(mp->ma_keys)) { + if (hint >= 0 && hint < mp->ma_keys->dk_nentries) { PyObject *res = NULL; PyDictKeyEntry *ep = DK_ENTRIES(mp->ma_keys) + (size_t)hint;