Skip to content

Commit 6a8a83c

Browse files
committed
use _PyLong_AsByteArray on all pythons
1 parent 3660a01 commit 6a8a83c

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

mypyc/lib-rt/int_ops.c

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

608-
#if PY_VERSION_HEX >= 0x030C0000
609-
// If not declared, declare it ourselves
610-
#ifndef PyLong_AsByteArray
611-
PyAPI_FUNC(int) PyLong_AsByteArray(
612-
PyLongObject* v,
613-
unsigned char* bytes,
614-
size_t n,
615-
int little_endian,
616-
int is_signed
617-
);
618-
#endif
619-
#define CPy_PyLong_AsByteArray PyLong_AsByteArray
620-
#else
621-
#define CPy_PyLong_AsByteArray _PyLong_AsByteArray
622-
#endif
623608

624609
// Helper for CPyLong_ToBytes (Python 3.2+)
625610
PyObject *CPyLong_ToBytes(PyObject *v, Py_ssize_t length, const char *byteorder, int signed_flag) {
@@ -639,7 +624,7 @@ PyObject *CPyLong_ToBytes(PyObject *v, Py_ssize_t length, const char *byteorder,
639624
PyErr_SetString(PyExc_ValueError, "byteorder must be either 'little' or 'big'");
640625
return NULL;
641626
}
642-
int res = CPy_PyLong_AsByteArray((PyLongObject *)v, bytes, length, little_endian, signed_flag);
627+
int res = _PyLong_AsByteArray((PyLongObject *)v, bytes, length, little_endian, signed_flag);
643628
if (res < 0) {
644629
PyMem_Free(bytes);
645630
return NULL;

0 commit comments

Comments
 (0)