X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/a172f897f4fdd800b3f70cdfe2140205f6b2f531..e5aa77d831ad8b42167f3205ee290f238003e20a:/pyke-mLib.c diff --git a/pyke-mLib.c b/pyke-mLib.c index a29f34c..900dc41 100644 --- a/pyke-mLib.c +++ b/pyke-mLib.c @@ -52,8 +52,11 @@ PyObject *getk64(kludge64 u) Py_DECREF(i); i = t; if ((j = PyLong_FromUnsignedLong(LO64(u))) == 0) goto end; if ((t = PyNumber_InPlaceOr(i, j)) == 0) goto end; +# ifdef PY2 Py_DECREF(i); i = t; - if ((rc = PyNumber_Int(i)) == 0) goto end; + if ((t = PyNumber_Int(i)) == 0) goto end; +# endif + rc = t; end: Py_XDECREF(i); Py_XDECREF(j); @@ -67,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 @@ -84,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); \ @@ -118,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;