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
Some internal C functions represent the number of bits in the Python integer as size_t or Py_ssize_t. It is fine on 64-bit platforms, where you need exbibytes of memory to get an overflow error. But on 32-bit platform you can create an integer objects that has a size of just 0.5 GiB.
This problem can be solved if always use 64-bit integers (uint64_t or int64_t) for bit counts. We can even introduce a hard limit for the range of integers in CPython (to $2^{2^{64}-1}$ or $2^{2^{63}-1}$) and remove the possibility of overflow error in _PyLong_NumBits() and _PyLong_Frexp(). No existing 64-bit platform supports such large address space, and even if they support, it would take years to create a single integer object of such size (just to fill memory).
Some internal C functions represent the number of bits in the Python integer as
size_torPy_ssize_t. It is fine on 64-bit platforms, where you need exbibytes of memory to get an overflow error. But on 32-bit platform you can create an integer objects that has a size of just 0.5 GiB.This problem can be solved if always use 64-bit integers ($2^{2^{64}-1}$ or $2^{2^{63}-1}$ ) and remove the possibility of overflow error in
uint64_torint64_t) for bit counts. We can even introduce a hard limit for the range of integers in CPython (to_PyLong_NumBits()and_PyLong_Frexp(). No existing 64-bit platform supports such large address space, and even if they support, it would take years to create a single integer object of such size (just to fill memory).Linked PRs