Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9cb0c38 commit 898cf85Copy full SHA for 898cf85
1 file changed
Objects/longobject.c
@@ -358,7 +358,11 @@ _PyLong_AsByteArray(PyLongObject* v,
358
pincr = -1;
359
}
360
361
- /* Copy over all the Python digits. */
+ /* Copy over all the Python digits.
362
+ It's crucial that every Python digit except for the MSD contribute
363
+ exactly SHIFT bits to the total, so first assert that the long is
364
+ normalized. */
365
+ assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
366
j = 0;
367
accum = 0;
368
accumbits = 0;
0 commit comments