Skip to content

Commit

Permalink
+ sync backport with CPython pr
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Sep 18, 2024
1 parent 3ed45cc commit 9ea2130
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pythoncapi_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,13 @@ PyLong_Export(PyObject *obj, PyLongExport *export_long)
PyLongObject *self = (PyLongObject*)obj;

int overflow;
#if SIZEOF_LONG == 8
long value = PyLong_AsLongAndOverflow(obj, &overflow);
#elif SIZEOF_LONG_LONG == 8
long long value = PyLong_AsLongLongAndOverflow(obj, &overflow);
#else
# error "unable to convert a long to int64_t"
#endif

if (!overflow) {
export_long->value = value;
Expand Down

0 comments on commit 9ea2130

Please sign in to comment.