Handle unmarshalling of large ints in Python bindings

This commit is contained in:
John J. Camilleri
2021-09-09 09:34:05 +02:00
parent 9739344ca6
commit 1d0c4e7c39
5 changed files with 26 additions and 12 deletions

View File

@@ -130,7 +130,10 @@ ExprLit_richcompare(ExprLitObject *t1, ExprLitObject *t2, int op)
if (t1->type != t2->type) goto done;
if (t1->type == 0) {
if (PyLong_AsLong(t1->value) != PyLong_AsLong(t2->value)) goto done;
int o1, o2;
int l1 = PyLong_AsLongAndOverflow(t1->value, &o1);
int l2 = PyLong_AsLongAndOverflow(t2->value, &o2);
if (!(l1 == l2 && o1 == o2)) goto done;
} else if (t1->type == 1) {
if (PyFloat_AsDouble(t1->value) != PyFloat_AsDouble(t2->value)) goto done;
} else if (t1->type == 2) {