8000 bpo-39943: Properly const the pointers in dictkeys_get_index (GH-19170) · python/cpython@62d21c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62d21c9

Browse files
authored
bpo-39943: Properly const the pointers in dictkeys_get_index (GH-19170)
1 parent cb6534e commit 62d21c9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Objects/dictobject.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,27 +331,27 @@ dictkeys_decref(PyDictKeysObject *dk)
331331

332332
/* lookup indices. returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */
333333
static inline Py_ssize_t
334-
dictkeys_get_index(PyDictKeysObject *keys, Py_ssize_t i)
334+
dictkeys_get_index(const PyDictKeysObject *keys, Py_ssize_t i)
335335
{
336336
Py_ssize_t s = DK_SIZE(keys);
337337
Py_ssize_t ix;
338338

339339
if (s <= 0xff) {
340-
int8_t *indices = (int8_t*)(keys->dk_indices);
340+
const int8_t *indices = (const int8_t*)(keys->dk_indices);
341341
ix = indices[i];
342342
}
343343
else if (s <= 0xffff) {
344-
int16_t *indices = (int16_t*)(keys->dk_indices);
344+
const int16_t *indices = (const int16_t*)(keys->dk_indices);
345345
ix = indices[i];
346346
}
347347
#if SIZEOF_VOID_P > 4
348348
else if (s > 0xffffffff) {
349-
int64_t *indices = (int64_t*)(keys->dk_indices);
349+
const int64_t *indices = (const int64_t*)(keys->dk_indices);
350350
ix = indices[i];
351351
}
352352
#endif
353353
else {
354-
int32_t *indices = (int32_t*)(keys->dk_indices);
354+
const int32_t *indices = (const int32_t*)(keys->dk_indices);
355355
ix = indices[i];
356356
}
357357
assert(ix >= DKIX_DUMMY);

0 commit comments

Comments
 (0)
0