Skip to content

gh-123497: New limit for Python integers on 64-bit platforms (signed) #123724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Sep 5, 2024

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 fits 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.

serhiy-storchaka and others added 6 commits August 30, 2024 13:52
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.
Co-authored-by: Victor Stinner <[email protected]>
@serhiy-storchaka
Copy link
Member Author

This is a variant of #123498 that uses int64_t instead of uint64_t.

Copy link
Member

@Eclips4 Eclips4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@serhiy-storchaka serhiy-storchaka merged commit d08c788 into python:main Sep 29, 2024
37 checks passed
@serhiy-storchaka serhiy-storchaka deleted the integer-upper-limit-signed branch September 29, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants