Skip to content

Commit

Permalink
Use PyLong_AsNativeBytes on Py3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Oct 13, 2024
1 parent f20630c commit a0cc7ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion msgspec/_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -11265,7 +11265,12 @@ ms_uuid_to_16_bytes(MsgspecState *mod, PyObject *obj, unsigned char *buf) {
return -1;
}
#if PY313_PLUS
int out = _PyLong_AsByteArray((PyLongObject *)int128, buf, 16, 0, 0, 1);
int out = (int)PyLong_AsNativeBytes(
int128,
buf,
16,
Py_ASNATIVEBYTES_BIG_ENDIAN | Py_ASNATIVEBYTES_UNSIGNED_BUFFER
);
#else
int out = _PyLong_AsByteArray((PyLongObject *)int128, buf, 16, 0, 0);
#endif
Expand Down

0 comments on commit a0cc7ea

Please sign in to comment.