Skip to content

Commit 9ff3a7c

Browse files
committed
fix _PyLong_AsByteArray compile err
1 parent be2d2de commit 9ff3a7c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mypyc/lib-rt/int_ops.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,12 @@ PyObject *CPyTagged_ToBytes(CPyTagged self, Py_ssize_t length, PyObject *byteord
605605
return result;
606606
}
607607

608+
#if PY_VERSION_HEX >= 0x030A0000
609+
#define CPy_PyLong_AsByteArray PyLong_AsByteArray
610+
#else
611+
#define CPy_PyLong_AsByteArray _PyLong_AsByteArray
612+
#endif
613+
608614
// Helper for CPyLong_ToBytes (Python 3.2+)
609615
PyObject *CPyLong_ToBytes(PyObject *v, Py_ssize_t length, const char *byteorder, int signed_flag) {
610616
// This is a wrapper for PyLong_AsByteArray and PyBytes_FromStringAndSize
@@ -623,7 +629,7 @@ PyObject *CPyLong_ToBytes(PyObject *v, Py_ssize_t length, const char *byteorder,
623629
PyErr_SetString(PyExc_ValueError, "byteorder must be either 'little' or 'big'");
624630
return NULL;
625631
}
626-
int res = PyLong_AsByteArray((PyLongObject *)v, bytes, length, little_endian, signed_flag);
632+
int res = CPy_PyLong_AsByteArray((PyLongObject *)v, bytes, length, little_endian, signed_flag);
627633
if (res < 0) {
628634
PyMem_Free(bytes);
629635
return NULL;

0 commit comments

Comments
 (0)