summaryrefslogtreecommitdiffstats
path: root/Modules/testcapi_long.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/testcapi_long.h')
-rw-r--r--Modules/testcapi_long.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/Modules/testcapi_long.h b/Modules/testcapi_long.h
index 8ed6b02..60ca326 100644
--- a/Modules/testcapi_long.h
+++ b/Modules/testcapi_long.h
@@ -97,6 +97,10 @@ TESTNAME(PyObject *error(const char*))
if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
return error(
"PyLong_AsUnsignedXXX(-1) didn't complain");
+ if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+ return error(
+ "PyLong_AsUnsignedXXX(-1) raised "
+ "something other than OverflowError");
PyErr_Clear();
UNBIND(x);
@@ -112,11 +116,15 @@ TESTNAME(PyObject *error(const char*))
return error(
"unexpected NULL from PyNumber_Lshift");
- uout = F_PY_TO_U(x);
+ uout = F_PY_TO_U(x);
if (uout != (unsigned TYPENAME)-1 || !PyErr_Occurred())
return error(
"PyLong_AsUnsignedXXX(2**NBITS) didn't "
"complain");
+ if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+ return error(
+ "PyLong_AsUnsignedXXX(2**NBITS) raised "
+ "something other than OverflowError");
PyErr_Clear();
/* Signed complains about 2**(NBITS-1)?
@@ -132,6 +140,10 @@ TESTNAME(PyObject *error(const char*))
return error(
"PyLong_AsXXX(2**(NBITS-1)) didn't "
"complain");
+ if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+ return error(
+ "PyLong_AsXXX(2**(NBITS-1)) raised "
+ "something other than OverflowError");
PyErr_Clear();
/* Signed complains about -2**(NBITS-1)-1?;
@@ -153,6 +165,10 @@ TESTNAME(PyObject *error(const char*))
return error(
"PyLong_AsXXX(-2**(NBITS-1)-1) didn't "
"complain");
+ if (!PyErr_ExceptionMatches(PyExc_OverflowError))
+ return error(
+ "PyLong_AsXXX(-2**(NBITS-1)-1) raised "
+ "something other than OverflowError");
PyErr_Clear();
UNBIND(y);