summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-06-28 23:53:56 (GMT)
committerGuido van Rossum <guido@python.org>2000-06-28 23:53:56 (GMT)
commit5e08cb8e50f5d63ba2c73c6eb678f7e442b89a3a (patch)
treef7a5b10442be588205aa195c7a90a9c42f5013e2 /Python/getargs.c
parentd7823f264570fb94f179e453330ea12f6158e2e5 (diff)
downloadcpython-5e08cb8e50f5d63ba2c73c6eb678f7e442b89a3a.zip
cpython-5e08cb8e50f5d63ba2c73c6eb678f7e442b89a3a.tar.gz
cpython-5e08cb8e50f5d63ba2c73c6eb678f7e442b89a3a.tar.bz2
Vladimir Marangozov:
This patch fixes a problem on AIX with the signed int case code in getargs.c, after Trent Mick's intervention about MIN/MAX overflow checks. The AIX compiler/optimizer generates bogus code with the default flags "-g -O" causing test_builtin to fail: int("10", 16) <> 16L. Swapping the two checks in the signed int code makes the problem go away. Also, make the error messages fit in 80 char lines in the source.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 69ef167..8cb4197 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -473,12 +473,12 @@ convertsimple1(arg, p_format, p_va)
return "integer<b>";
else if (ival < 0) {
PyErr_SetString(PyExc_OverflowError,
- "unsigned byte integer is less than minimum");
+ "unsigned byte integer is less than minimum");
return "integer<b>";
}
else if (ival > UCHAR_MAX) {
PyErr_SetString(PyExc_OverflowError,
- "unsigned byte integer is greater than maximum");
+ "unsigned byte integer is greater than maximum");
return "integer<b>";
}
else
@@ -494,12 +494,12 @@ convertsimple1(arg, p_format, p_va)
return "integer<h>";
else if (ival < SHRT_MIN) {
PyErr_SetString(PyExc_OverflowError,
- "signed short integer is less than minimum");
+ "signed short integer is less than minimum");
return "integer<h>";
}
else if (ival > SHRT_MAX) {
PyErr_SetString(PyExc_OverflowError,
- "signed short integer is greater than maximum");
+ "signed short integer is greater than maximum");
return "integer<h>";
}
else
@@ -513,14 +513,14 @@ convertsimple1(arg, p_format, p_va)
long ival = PyInt_AsLong(arg);
if (ival == -1 && PyErr_Occurred())
return "integer<i>";
- else if (ival < INT_MIN) {
+ else if (ival > INT_MAX) {
PyErr_SetString(PyExc_OverflowError,
- "signed integer is less than minimum");
+ "signed integer is greater than maximum");
return "integer<i>";
}
- else if (ival > INT_MAX) {
+ else if (ival < INT_MIN) {
PyErr_SetString(PyExc_OverflowError,
- "signed integer is greater than maximum");
+ "signed integer is less than minimum");
return "integer<i>";
}
else