* @brief Shim for `_PyLong_AsByteArray`. * Python 3.13.0a4 added a new public API `PyLong_AsNativeBytes()` to replace the private `_PyLong_AsByteArray()`. * But this change also modified the function signature of `_PyLong_AsByteArray()`. * @see https://github.com/python/cpython/issues/111140 */
| 135 | * @see https://github.com/python/cpython/issues/111140 |
| 136 | */ |
| 137 | inline int PyLong_AsByteArray(PyLongObject *v, unsigned char *bytes, size_t n, bool little_endian, bool is_signed) { |
| 138 | #if PY_VERSION_HEX >= 0x030d0000 // Python version is 3.13 or higher |
| 139 | return _PyLong_AsByteArray(v, bytes, n, little_endian, is_signed, /*with_exceptions*/ false); |
| 140 | #else |
| 141 | return _PyLong_AsByteArray(v, bytes, n, little_endian, is_signed); |
| 142 | #endif |
| 143 | } |
| 144 | |
| 145 | #endif // #ifndef PythonMonkey_py_version_shim_ |