Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
gh-102471, PEP 757: Add PyLong import and export API #121339
base: main
Are you sure you want to change the base?
gh-102471, PEP 757: Add PyLong import and export API #121339
Changes from 29 commits
f4fdbf2
c2e568e
f0d9525
b19764f
6f7fd11
080e079
1a7902f
b70a6dd
07552a7
0d0f942
762c33a
20be7a3
d92bf1e
b3b02a2
caca2d7
4221a49
37b1d49
d70a121
4aa25f6
90973d4
5d3e224
c7d7cb2
a3d601a
c049268
06b196b
3e8d296
86c68c2
a8fd669
a04f9d0
b2be94a
ca98ad1
167d75e
5e53a5b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vstinner, after some thinking I believe we should drop this contract, if we take into account future changes in internals of CPython's integers. If single layout view will be invalid - this function, probably, will allocate temporary buffers. That might fail.
Can we offer a different contract instead, something like this: "This function always succeeds if obj is a Python
int
object or a subclass and it's value can't be converted to C long."? In this case users have a clear hint: "try something like PyLong_AsLongAndOverflow and if it fails - fallback to this function". If not, I think this is a severe issue with that part of API.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No fallback to
PyLong_AsLongAndOverflow
should be needed with this API, thanks to the embeddedint64_t value
.