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

Support PyLong_AsNativeBytes()? #107

Closed
skirpichev opened this issue Sep 18, 2024 · 4 comments
Closed

Support PyLong_AsNativeBytes()? #107

skirpichev opened this issue Sep 18, 2024 · 4 comments

Comments

@skirpichev
Copy link
Member

I would guess it wasn't supported, well, for obvious reasons (complexity).

But if it's going to be used in PyLong_Export() - maybe we should revisit it?

@vstinner
Copy link
Member

The implementation is about 186 lines. IMO it's too big and too complex for pythoncapi-compat sadly :-( The https://github.com/vstinner/deadparrot would be a better place to backport such feature.

@skirpichev
Copy link
Member Author

Then maybe using PyLong_AsLongAndOverflow() is better for PyLong_Export. I did pr to switch: vstinner/cpython#6. This clear practical need for backport.

@vstinner
Copy link
Member

You shouldn't worry about pythoncapi-compat: there is a great freedom on how we can do things in pythoncapi-compat. It shouldn't impact PEP 757 design.

@skirpichev
Copy link
Member Author

Sure, we could use PyLong_AsLongAndOverflow() just for backports. But it looks faster than current solution, at least for my benchmarks.

@skirpichev skirpichev closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
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

No branches or pull requests

2 participants