diff options
author | Andy Lester <andy@petdance.com> | 2020-03-26 04:13:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 04:13:01 (GMT) |
commit | 62d21c9d900664b2ca30c2d7edd80b6628abdf62 (patch) | |
tree | 7388ff6ce2d11da873b679dce82b3b05b3daf128 /Objects | |
parent | cb6534e1a8833b3f20bd88f52cf62a003426e855 (diff) | |
download | cpython-62d21c9d900664b2ca30c2d7edd80b6628abdf62.zip cpython-62d21c9d900664b2ca30c2d7edd80b6628abdf62.tar.gz cpython-62d21c9d900664b2ca30c2d7edd80b6628abdf62.tar.bz2 |
bpo-39943: Properly const the pointers in dictkeys_get_index (GH-19170)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/dictobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 4aa927a..2ca32b5 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -331,27 +331,27 @@ dictkeys_decref(PyDictKeysObject *dk) /* lookup indices. returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */ static inline Py_ssize_t -dictkeys_get_index(PyDictKeysObject *keys, Py_ssize_t i) +dictkeys_get_index(const PyDictKeysObject *keys, Py_ssize_t i) { Py_ssize_t s = DK_SIZE(keys); Py_ssize_t ix; if (s <= 0xff) { - int8_t *indices = (int8_t*)(keys->dk_indices); + const int8_t *indices = (const int8_t*)(keys->dk_indices); ix = indices[i]; } else if (s <= 0xffff) { - int16_t *indices = (int16_t*)(keys->dk_indices); + const int16_t *indices = (const int16_t*)(keys->dk_indices); ix = indices[i]; } #if SIZEOF_VOID_P > 4 else if (s > 0xffffffff) { - int64_t *indices = (int64_t*)(keys->dk_indices); + const int64_t *indices = (const int64_t*)(keys->dk_indices); ix = indices[i]; } #endif else { - int32_t *indices = (int32_t*)(keys->dk_indices); + const int32_t *indices = (const int32_t*)(keys->dk_indices); ix = indices[i]; } assert(ix >= DKIX_DUMMY); |