gh-111140: Adds PyLong_AsNativeBytes and PyLong_FromNative[Unsigned]Bytes functions (GH-114886)

This commit is contained in:
Steve Dower 2024-02-12 20:13:13 +00:00 committed by GitHub
parent a82fbc13d0
commit 7861dfd26a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 533 additions and 26 deletions

View file

@ -1000,9 +1000,10 @@ bp_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
(unsigned char *)p,
8,
0, /* little_endian */
1 /* signed */);
1, /* signed */
0 /* !with_exceptions */);
Py_DECREF(v);
if (res == -1 && PyErr_Occurred()) {
if (res < 0) {
PyErr_Format(state->StructError,
"'%c' format requires %lld <= number <= %lld",
f->format,
@ -1024,9 +1025,10 @@ bp_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f
(unsigned char *)p,
8,
0, /* little_endian */
0 /* signed */);
0, /* signed */
0 /* !with_exceptions */);
Py_DECREF(v);
if (res == -1 && PyErr_Occurred()) {
if (res < 0) {
PyErr_Format(state->StructError,
"'%c' format requires 0 <= number <= %llu",
f->format,
@ -1260,9 +1262,10 @@ lp_longlong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f)
(unsigned char *)p,
8,
1, /* little_endian */
1 /* signed */);
1, /* signed */
0 /* !with_exceptions */);
Py_DECREF(v);
if (res == -1 && PyErr_Occurred()) {
if (res < 0) {
PyErr_Format(state->StructError,
"'%c' format requires %lld <= number <= %lld",
f->format,
@ -1284,9 +1287,10 @@ lp_ulonglong(_structmodulestate *state, char *p, PyObject *v, const formatdef *f
(unsigned char *)p,
8,
1, /* little_endian */
0 /* signed */);
0, /* signed */
0 /* !with_exceptions */);
Py_DECREF(v);
if (res == -1 && PyErr_Occurred()) {
if (res < 0) {
PyErr_Format(state->StructError,
"'%c' format requires 0 <= number <= %llu",
f->format,