Victor Stinner
Victor Stinner
@i-l-s-h-a-t: Interesting bug. It's unrelated to Python, so can you please open an issue at https://github.com/python/pythoncapi-compat/issues? Please include commands on how to reproduce your issue.
cc @skirpichev @casevh
See also issue https://github.com/python/cpython/issues/111415
I updated my PR: * Use -1 for little endian and +1 for big endian. * Rename PyUnstable_LongExport to PyUnstable_Long_DigitArray. * Add "always succeed" mention in the doc.
@skirpichev: I added a PyLongWriter API similar to what @encukou proposed. Example: ```c PyLongObject * _PyLong_FromDigits(int negative, Py_ssize_t digit_count, digit *digits) { PyLongWriter *writer = PyLongWriter_Create(); if (writer == NULL)...
I mark the PR as a draft until we agree on the API.
I updated the PR to remove the `PyUnstable_` prefix, replace it with the `PyLong` prefix.
> But cost is 5 (!) public functions and one new struct, additionally to PyUnstable_Long_Import(), which will be a more slow API. Correct? C.f. just one function in https://github.com/python/cpython/pull/121339#discussion_r1665029240 proposal....
@skirpichev: Would it be useful to add a `PyLongWriter_SetValue(PyLongWriter *writer, long value)` function? It would be similar to `PyLong_FromLong(long value)` (but may be less efficient), so I'm not sure if...
@skirpichev: I rewrote `PyLongWriter` API to make it simpler and avoid PyMem_Malloc/PyMem_Free(): ```c PyLongObject * _PyLong_FromDigits(int negative, Py_ssize_t digit_count, digit *digits) { Py_digit *writer_digits; PyLongWriter *writer = PyLongWriter_Create(digit_count, &writer_digits); if...