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

CPython 3.13: add _PyLong_New() and import some macros from pycore_hash.h #441

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

skirpichev
Copy link
Contributor

Turn on basic tests on 3.13

Closes #417

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2023

Codecov Report

Merging #441 (1edb036) into master (e094479) will not change coverage.
The diff coverage is n/a.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@           Coverage Diff           @@
##           master     #441   +/-   ##
=======================================
  Coverage   83.41%   83.41%           
=======================================
  Files          49       49           
  Lines       11797    11797           
  Branches     2205     2205           
=======================================
  Hits         9841     9841           
  Misses       1956     1956           
Files Coverage Δ
src/gmpy2_hash.c 71.95% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@skirpichev
Copy link
Contributor Author

I think we should decide which C-API we need. I would guess, something like mpz_limbs_read/mpz_limbs_write - i.e. access to the internal ob_digit array (see also this: cython/cython#5238 (comment)).

@casevh
Copy link
Collaborator

casevh commented Oct 25, 2023

Thanks for fixing this.

Regarding a C-API that would be nice to have, I what do you think about proposing that CPython provides suitably renamed functions PyNewStyleInteger_FromOldStyleLong and PyNewStyleInteger_AsOldStyleLong? OldStyleLong wouldn't be a numeric type but rather a memory buffer that has the same layout as the pre-3.12 PyLong type.

@casevh casevh merged commit ff2ec3d into aleaxit:master Oct 25, 2023
8 checks passed
@skirpichev skirpichev deleted the fix-for-cpython3.13 branch October 25, 2023 04:57
@skirpichev
Copy link
Contributor Author

@casevh, maybe something like this, yes. I still feel CPython people should try gmp-like API, as mentioned above.

I'll open an issue or start a discussion thread in d.p.o. Before, I'll look into more projects that may need this kind of stuff, besides gmpy2 and cython. Sage, perhaps? @oscarbenjamin, would you like to have this type of interface for python flint bindings? So far e.g. I see fmpz_get_intlong() do fmpz->int conversion using strings.

@casevh
Copy link
Collaborator

casevh commented Oct 25, 2023 via email

@oscarbenjamin
Copy link

would you like to have this type of interface for python flint bindings?

Yes, I think so.

There is a PR here to try to optimise converting from a CPython int: flintlib/python-flint#64

Also efficient conversions between python-flint and gmpy2 would be good: flintlib/python-flint#56

What would be nice is if there was somehow a general API for doing this with any arbitrary precision integer type so that efficient conversions could be done for any of them rather than needing special casing for each type.

@skirpichev
Copy link
Contributor Author

python/cpython#102471 seems to be the right upstream issue

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.

Build failure on CPython 3.13 (dev)
4 participants