Victor Stinner

Results 702 comments of Victor Stinner

> PyLong_FromLimbs(plimbs, sign, num_limbs, limb_bits, bits_per_limb) > PyLong_ToLimbs(plimbs, &sign, pylong, num_limbs, limb_bits, bits_per_limb) I have no idea how to implement an import/export function which takes arbitrary *limb_bits* and *bits_per_limb* arguments....

> I doubt, that PyLongWriter_SetNegative() is useful: you can include sign in PyLongWriter_Create(). In this way you proposal will match mine (up to function names and a new struct:)) Ok,...

> The trick that would get you the zero-copy that was asked for is for PyLong_DigitArray (in this example) to be the actual PyLongObject instance, just cast to a different...

> Apparently, speed is not an issue anymore: numbers are closer to my version (or equal). Great!

I wrote documentation for the `PyLongWriter` API with a small example (create an integer of a single digit).

PR updated: * Remove `PyLong_Import()` function: I kept it as an example in the doc since it's short enough, and IMO helps to understand the non-trivial API. * Make `PyLong_DigitArray.digits`...

@serhiy-storchaka: > Then please used different names than PyLong_Import()/PyLong_Export(). Would you prefer that I rename PyLong_Export() to PyLong_AsDigitArray(), and PyLong_ReleaseExport() to PyLong_FreeDigitArray()? I already removed PyLong_Import(), there are now PyLongWriter_Create()+PyLongWriter_Fininsh()...

@picnixz: Such coding style review is not helping. It's the first version of the PR, we didn't discuss the API yet. I would prefer comments about the API rather than...

@picnixz: I would prefer to make the API as small as possible. Where do these use cases come from? Did you see usage in the current C code of CPython...

> Errr.. my idea was to have a parity with the PyUnicodeWriter API Look at the current usage of `_PyBytesWriter`. You will see that the code is very different. The...