]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Correctly compare the hint against the keys in _PyDict_GetItemHint (GH-22960)
authorPablo Galindo <Pablogsal@gmail.com>
Sun, 25 Oct 2020 06:08:17 +0000 (06:08 +0000)
committerGitHub <noreply@github.com>
Sun, 25 Oct 2020 06:08:17 +0000 (06:08 +0000)
Objects/dictobject.c

index 8e74962345286842fe61ea4f18ff80b9578daa9e..42d71e56d4547ca9370942f1e140e74bc500933d 100644 (file)
@@ -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;