You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 30, 2023. It is now read-only.
sage.arith.long.integer_check_py: fix for python 3.11
Previous code assumed `PyLong_SHIFT` is 15 on a 32-bit system, which is
no longer true on python 3.11 (`PyLong_SHIFT` defaults to 30 now both on
32-bit and 64-bit systems).
We now assume `PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT`.
This is true in all the default configurations:
- BITS_IN_LONG = 63, PyLong_SHIFT = 30
- BITS_IN_LONG = 31, PyLong_SHIFT = 15 (python <= 3.10)
- BITS_IN_LONG = 31, PyLong_SHIFT = 30 (new in python 3.11)
The current code asserts `2 * PyLong_SHIFT <= BITS_IN_LONG` and indeed
the implementation is broken when `BITS_IN_LONG < 2 * PyLong_SHIFT`
since it doesn't handle overflow in the second digit. I changed the
current code in the simplest possible way that fixes this.
0 commit comments