This seems to match better what Python does under these conditions.
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
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); \
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;
## Check overflow detection.
h0, _ = makefn(w)
- me.assertRaises((OverflowError, ValueError),
- hashfn, h0, 1 << 8*w)
+ me.assertRaises(OverflowError, hashfn, h0, 1 << 8*w)
def check_hashbuffer_bufn(me, w, bigendp, makefn, hashfn):
"""Check `hashbufN'."""
me.assertEqual(putfn(C.WriteBuffer(), C.MP(0)).contents, w*C.bytes("00"))
## Check overflow detection.
- me.assertRaises((OverflowError, ValueError),
- putfn, C.WriteBuffer(), 1 << 8*w)
+ me.assertRaises(OverflowError, putfn, C.WriteBuffer(), 1 << 8*w)
def check_putbufn(me, w, bigendp, putfn):
"""Check `putblkN'."""