mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix MSVC compiler warnings in dictobject.c (GH-26432)
This commit is contained in:
parent
8b4312b909
commit
21dd43c01d
2 changed files with 6 additions and 4 deletions
|
@ -545,6 +545,8 @@ _odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
|||
return ix;
|
||||
}
|
||||
|
||||
#define ONE ((Py_ssize_t)1)
|
||||
|
||||
/* Replace od->od_fast_nodes with a new table matching the size of dict's. */
|
||||
static int
|
||||
_odict_resize(PyODictObject *od)
|
||||
|
@ -553,7 +555,7 @@ _odict_resize(PyODictObject *od)
|
|||
_ODictNode **fast_nodes, *node;
|
||||
|
||||
/* Initialize a new "fast nodes" table. */
|
||||
size = 1 << (((PyDictObject *)od)->ma_keys->dk_log2_size);
|
||||
size = ONE << (((PyDictObject *)od)->ma_keys->dk_log2_size);
|
||||
fast_nodes = PyMem_NEW(_ODictNode *, size);
|
||||
if (fast_nodes == NULL) {
|
||||
PyErr_NoMemory();
|
||||
|
@ -592,7 +594,7 @@ _odict_get_index(PyODictObject *od, PyObject *key, Py_hash_t hash)
|
|||
|
||||
/* Ensure od_fast_nodes and dk_entries are in sync. */
|
||||
if (od->od_resize_sentinel != keys ||
|
||||
od->od_fast_nodes_size != (1 << (keys->dk_log2_size))) {
|
||||
od->od_fast_nodes_size != (ONE << (keys->dk_log2_size))) {
|
||||
int resize_res = _odict_resize(od);
|
||||
if (resize_res < 0)
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue