Skip to content

Commit

Permalink
Set digit count correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Oct 25, 2023
1 parent 5d97741 commit c3002e2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3389,15 +3389,11 @@ x_add(PyLongObject *a, PyLongObject *b)
z->long_value.ob_digit[i] = carry & PyLong_MASK;
carry >>= PyLong_SHIFT;
}
assert(carry==0 || extra_digit);
assert(carry == 0 || extra_digit);
if (extra_digit) {
z->long_value.ob_digit[i] = carry;
if (!carry) {
/* rare case: we didn't need the extra digit after all */
Py_SET_SIZE(z, size_a);
}
}
return z;
return long_normalize(z);
}

/* Subtract the absolute values of two integers. */
Expand Down

0 comments on commit c3002e2

Please sign in to comment.