diff options
| author | Pablo Galindo <Pablogsal@gmail.com> | 2020-10-25 06:08:17 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-25 06:08:17 +0000 |
| commit | 492d513ccbebeec40a8ba85cbd894a027ca5b2b3 (patch) | |
| tree | c701fc6d9d0419feecf4b9d48b238dbf50f60d23 | |
| parent | 4a9c6379380defd37b5483607d0d804db18f7812 (diff) | |
| download | cpython-git-492d513ccbebeec40a8ba85cbd894a027ca5b2b3.tar.gz | |
Correctly compare the hint against the keys in _PyDict_GetItemHint (GH-22960)
| -rw-r--r-- | Objects/dictobject.c | 2 |
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; |
