Skip to content
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

PEP 757: use PyLong_Export #3970

Merged
merged 8 commits into from
Sep 17, 2024
Merged

PEP 757: use PyLong_Export #3970

merged 8 commits into from
Sep 17, 2024

Conversation

skirpichev
Copy link
Member

@skirpichev skirpichev commented Sep 17, 2024

  • Change is either:
    • To a Draft PEP
    • To an Accepted or Final PEP, with Steering Council approval
    • To fix an editorial issue (markup, typo, link, header, etc)
  • PR title prefixed with PEP number (e.g. PEP 123: Summary of changes)

This change export API to Antoine Pitrou -like proposal.

  • I'm unsure if we should use signed type for value or store here absolute value.
  • Right now, we probably can put compact value to this field, but using PyLong_AsLongAndOverflow first seems to be faster. So, we might just reserve value field for future use.

📚 Documentation preview 📚: https://pep-previews--3970.org.readthedocs.build/

peps/pep-0757.rst Outdated Show resolved Hide resolved
peps/pep-0757.rst Outdated Show resolved Hide resolved
peps/pep-0757.rst Outdated Show resolved Hide resolved
peps/pep-0757.rst Show resolved Hide resolved
peps/pep-0757.rst Outdated Show resolved Hide resolved
peps/pep-0757.rst Outdated Show resolved Hide resolved
peps/pep-0757.rst Outdated Show resolved Hide resolved
peps/pep-0757.rst Outdated Show resolved Hide resolved
peps/pep-0757.rst Outdated Show resolved Hide resolved
* minor edits (fix section header, etc)
* redo example, assuming that for compact integers - value set
peps/pep-0757.rst Outdated Show resolved Hide resolved
@vstinner vstinner marked this pull request as ready for review September 17, 2024 15:34
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner merged commit b4e7700 into python:main Sep 17, 2024
6 checks passed
@vstinner
Copy link
Member

This version is maybe not perfect, but it's a great step forward for smaller integers (IMO). I merged your PR, thanks.

I'm not sure if value should be int64_t or uint64_t+negative, we can play with the implementation to tune this.

@skirpichev skirpichev deleted the pep757-export branch September 17, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants