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

Incompatibility with Python 3.12 #137

Closed
encukou opened this issue Jun 30, 2023 · 2 comments · Fixed by #138
Closed

Incompatibility with Python 3.12 #137

encukou opened this issue Jun 30, 2023 · 2 comments · Fixed by #138
Milestone

Comments

@encukou
Copy link

encukou commented Jun 30, 2023

Python 3.12 changes the internal representation of int objects (to speed up common cases). Usage of Py_SIZE and ob_digit in convert.pyx will fail.

The supported way of extracting the value of integers (if they don't fit in a C long long) is the Python method to_bytes, and there's from_bytes to go back. (If this is too slow for cypari, please chime in in the discussion.)

(edit) See also: python/cpython#101292

@tornaria
Copy link
Contributor

tornaria commented Oct 2, 2023

Could we use _PyLong_FromByteArray and _PyLong_AsByteArray ?

@tornaria
Copy link
Contributor

tornaria commented Oct 2, 2023

I think those will be hard to use because pari/gmp stores integers in "word little-endian" meaning [word0, word1, word2, ...]. This is the same as byte little-endian when the words themselves are little-endian. But in a big-endian architecture, there's no natural way to do it.

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 a pull request may close this issue.

3 participants