Skip to content

Impose new limit for Python integers #123497

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions