I discussed with PyPy developers. First of all, the PyPy C API has no PyLongObject.ob_digit
member, so gmpy2, SAGE and Python-FLINT don’t support PyPy currently.
PyPy int
objects can be moved in memory (moving GC, Python int
objects cannot be pinned in memory), so a memory copy is needed to export an array of digits. IMO that’s not an issue, it’s ok to copy memory in the PyPy case.
Current, int.to_bytes()
and int.from_bytes()
can be used to export/import Python int
objects.