From 492d513ccbebeec40a8ba85cbd894a027ca5b2b3 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sun, 25 Oct 2020 06:08:17 +0000 Subject: Correctly compare the hint against the keys in _PyDict_GetItemHint (GH-22960) --- Objects/dictobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 8e74962..42d71e5 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; -- cgit v0.12