Skip to content

Commit

Permalink
simplify binode_to_dict()
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanschnell committed Jan 23, 2024
1 parent 66a0042 commit 1a1dac8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions bitarray/_bitarray.c
Expand Up @@ -3004,9 +3004,7 @@ binode_to_dict(binode *nd, PyObject *dict, bitarrayobject *prefix)

if (nd->symbol) {
assert(nd->child[0] == NULL && nd->child[1] == NULL);
if (PyDict_SetItem(dict, nd->symbol, (PyObject *) prefix) < 0)
return -1;
return 0;
return PyDict_SetItem(dict, nd->symbol, (PyObject *) prefix);
}

for (k = 0; k < 2; k++) {
Expand Down Expand Up @@ -3473,9 +3471,8 @@ searchiter_next(searchiterobject *it)

/* range checks necessary in case self changed during iteration */
assert(it->start >= 0);
if (it->start > nbits || it->stop < 0 || it->stop > nbits) {
if (it->start > nbits || it->stop < 0 || it->stop > nbits)
return NULL; /* stop iteration */
}

pos = find_obj(it->self, it->sub, it->start, it->stop, it->right);
assert(pos > -2); /* cannot happen - we called value_sub() before */
Expand Down

0 comments on commit 1a1dac8

Please sign in to comment.