diff options
author | Yury Selivanov <yury@magic.io> | 2018-01-29 18:31:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-29 18:31:37 (GMT) |
commit | b647d7039d396b1da71ab33b101a78b53d4e6834 (patch) | |
tree | ae88d3bcfced612414727bb236e2ebb89c8d72a0 /Python | |
parent | aa218d1649690d1c1ba86a9972f7fae646bf1a8f (diff) | |
download | cpython-b647d7039d396b1da71ab33b101a78b53d4e6834.zip cpython-b647d7039d396b1da71ab33b101a78b53d4e6834.tar.gz cpython-b647d7039d396b1da71ab33b101a78b53d4e6834.tar.bz2 |
bpo-32707: Fix warnings in hamt.c (#5430)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/hamt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/hamt.c b/Python/hamt.c index 79c42c0..38f76d1 100644 --- a/Python/hamt.c +++ b/Python/hamt.c @@ -620,7 +620,8 @@ hamt_node_bitmap_clone_without(PyHamtNode_Bitmap *o, uint32_t bit) new->b_array[i] = o->b_array[i]; } - for (i = val_idx + 1; i < Py_SIZE(o); i++) { + assert(Py_SIZE(o) >= 0 && Py_SIZE(o) <= 32); + for (i = val_idx + 1; i < (uint32_t)Py_SIZE(o); i++) { Py_XINCREF(o->b_array[i]); new->b_array[i - 2] = o->b_array[i]; } @@ -920,7 +921,7 @@ hamt_node_bitmap_assoc(PyHamtNode_Bitmap *self, uint32_t key_idx = 2 * idx; uint32_t val_idx = key_idx + 1; - Py_ssize_t i; + uint32_t i; *added_leaf = 1; @@ -947,7 +948,8 @@ hamt_node_bitmap_assoc(PyHamtNode_Bitmap *self, /* Copy all keys/values that will be after the new key/value we are adding. */ - for (i = key_idx; i < Py_SIZE(self); i++) { + assert(Py_SIZE(self) >= 0 && Py_SIZE(self) <= 32); + for (i = key_idx; i < (uint32_t)Py_SIZE(self); i++) { Py_XINCREF(self->b_array[i]); new_node->b_array[i + 2] = self->b_array[i]; } |