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
The upper limit of Python integers is determined by by the size of addressable memory. On 64-bit platforms this is about $2^{63}$ bytes or about $15\cdot 2^{62} < 2^{66}$ bits. Unfortunately, the number of bits of some integers cannot be represented as a 64-bit integer, this complicates the code.
The following PR lowers the limit to about $2^{64}$ bits or about $2^{65}/15 > 2^{61}$ bytes. It is still much larger than practically achievable (larger that the limit of addressable memory in modern processors).
Instead of be limited just by the size of addressable memory (2**63
bytes), Python integers are now also limited by the number of bits, so
the number of bit now always fit in 64-bit integer.
Both limits are much larger than what can be available on practice, so
there is no effect on users.
_PyLong_NumBits() and _PyLong_Frexp() are now always successful.
Instead of be limited just by the size of addressable memory (2**63
bytes), Python integers are now also limited by the number of bits, so
the number of bit now always fit in a 64-bit integer.
Both limits are much larger than what might be available in practice,
so it doesn't affect users.
_PyLong_NumBits() and _PyLong_Frexp() are now always successful.
The upper limit of Python integers is determined by by the size of addressable memory. On 64-bit platforms this is about$2^{63}$ bytes or about $15\cdot 2^{62} < 2^{66}$ bits. Unfortunately, the number of bits of some integers cannot be represented as a 64-bit integer, this complicates the code.
The following PR lowers the limit to about$2^{64}$ bits or about $2^{65}/15 > 2^{61}$ bytes. It is still much larger than practically achievable (larger that the limit of addressable memory in modern processors).
First proposed in #121486, then discussed in https://discuss.python.org/t/imposing-a-hard-limit-on-python-integers/62302.
Linked PRs
The text was updated successfully, but these errors were encountered: