From: Mark Wooding Date: Sat, 23 Nov 2019 15:05:39 +0000 (+0000) Subject: pyke/pyke-mLib.c: Raise `OverflowError' on out-of-range inputs. X-Git-Url: https://git.distorted.org.uk/~mdw/pyke/commitdiff_plain/6c2569879c220eeac35957cdba9a043e8a5ea9ed pyke/pyke-mLib.c: Raise `OverflowError' on out-of-range inputs. This seems to match better what Python does under these conditions. --- diff --git a/pyke-mLib.c b/pyke-mLib.c index 30f6735..900dc41 100644 --- a/pyke-mLib.c +++ b/pyke-mLib.c @@ -70,7 +70,7 @@ end: uint64 t; \ if (!convk64(o, &k)) goto end; \ t = GET64(uint64, k); \ - if (t > MASK##n) VALERR("out of range"); \ + if (t > MASK##n) OVFERR("out of range"); \ *p = t; \ } while (0) #else @@ -87,7 +87,7 @@ end: CONVu64(n); \ else { \ if (!convulong(o, &u)) goto end; \ - if (u > MASK##n) VALERR("out of range"); \ + if (u > MASK##n) OVFERR("out of range"); \ *p = u; \ } \ return (1); \ @@ -121,7 +121,7 @@ int convk64(PyObject *o, void *pp) hi = PyInt_AsUnsignedLongMask(i); if ((t = PyNumber_InPlaceRshift(i, i32)) == 0) goto end; Py_DECREF(i); i = t; - if (PyObject_IsTrue(i)) VALERR("out of range"); + if (PyObject_IsTrue(i)) OVFERR("out of range"); SET64(*(kludge64 *)pp, hi, lo); #endif rc = 1;