mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
_PyLong_AsByteArray: added assert that the input is normalized. This is
outside the function's control, but is crucial to correct operation.
This commit is contained in:
parent
9cb0c38fff
commit
898cf85c25
1 changed files with 5 additions and 1 deletions
|
@ -358,7 +358,11 @@ _PyLong_AsByteArray(PyLongObject* v,
|
||||||
pincr = -1;
|
pincr = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy over all the Python digits. */
|
/* Copy over all the Python digits.
|
||||||
|
It's crucial that every Python digit except for the MSD contribute
|
||||||
|
exactly SHIFT bits to the total, so first assert that the long is
|
||||||
|
normalized. */
|
||||||
|
assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
|
||||||
j = 0;
|
j = 0;
|
||||||
accum = 0;
|
accum = 0;
|
||||||
accumbits = 0;
|
accumbits = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue