summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-10-25 06:08:17 +0000
committerGitHub <noreply@github.com>2020-10-25 06:08:17 +0000
commit492d513ccbebeec40a8ba85cbd894a027ca5b2b3 (patch)
treec701fc6d9d0419feecf4b9d48b238dbf50f60d23
parent4a9c6379380defd37b5483607d0d804db18f7812 (diff)
downloadcpython-git-492d513ccbebeec40a8ba85cbd894a027ca5b2b3.tar.gz
Correctly compare the hint against the keys in _PyDict_GetItemHint (GH-22960)
-rw-r--r--Objects/dictobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 8e74962345..42d71e56d4 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;