Skip to content

Commit

Permalink
+ use PyLong_AsLongAndOverflow in pythoncapi_compat.h
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Sep 18, 2024
1 parent 93426a2 commit 676696e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pythoncapi_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -1265,8 +1265,8 @@ PyLong_Export(PyObject *obj, PyLongExport *export_long)
}
PyLongObject *self = (PyLongObject*)obj;

int64_t value;
Py_ssize_t bytes = PyLong_AsNativeBytes(self, &value, sizeof(value), -1);
int overflow;
long value = PyLong_AsLongAndOverflow(obj, &overflow);

if ((size_t)bytes <= sizeof(value)) {
export_long->value = value;
Expand Down

0 comments on commit 676696e

Please sign in to comment.