flintlib / python-flint

Python bindings for Flint and Arb
MIT License
132 stars 27 forks source link

More efficient conversion from Python int to fmpz #159

Open oscarbenjamin opened 4 months ago

oscarbenjamin commented 4 months ago

It looks like Python 3.13 will provide public C API for efficiently converting to and from a PyLong. These should be compatible with mpz_import/mpz_export rather than converting between hex strings:

https://github.com/python/cpython/pull/121339

https://github.com/flintlib/python-flint/blob/430b8e50f4d8e697d4f5c7666d7b75f3e440a260/src/flint/types/fmpz.pxd#L15-L23 https://github.com/flintlib/python-flint/blob/430b8e50f4d8e697d4f5c7666d7b75f3e440a260/src/flint/types/fmpz.pyx#L16-L27

skirpichev commented 4 months ago

It looks like Python 3.13 will provide public C API

Nit: 3.14. Maybe.