summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-18 00:12:30 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-18 00:12:30 (GMT)
commitfce26e7f9fa3ed04a47ea91f6f4becf227cfa140 (patch)
tree545ce0caf922ef5aad3f1fc5b4214ba1a2fbc9ff
parent10cf21802d2417c794630f7642a128b757b0a5cb (diff)
downloadcpython-fce26e7f9fa3ed04a47ea91f6f4becf227cfa140.zip
cpython-fce26e7f9fa3ed04a47ea91f6f4becf227cfa140.tar.gz
cpython-fce26e7f9fa3ed04a47ea91f6f4becf227cfa140.tar.bz2
Roll back changes to 'h' format code -- too much breaks. Other
changes stay.
-rw-r--r--Python/getargs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index e9808d5..237a29d 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -456,7 +456,7 @@ convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf,
break;
}
- case 'h': {/* unsigned short int */
+ case 'h': {/* signed short int */
short *p = va_arg(*p_va, short *);
long ival;
if (float_argument_error(arg))
@@ -464,14 +464,14 @@ convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf,
ival = PyInt_AsLong(arg);
if (ival == -1 && PyErr_Occurred())
return converterr("integer<h>", arg, msgbuf, bufsize);
- else if (ival < 0) {
+ else if (ival < SHRT_MIN) {
PyErr_SetString(PyExc_OverflowError,
- "unsigned short integer is less than minimum");
+ "signed short integer is less than minimum");
return converterr("integer<h>", arg, msgbuf, bufsize);
}
- else if (ival > USHRT_MAX) {
+ else if (ival > SHRT_MAX) {
PyErr_SetString(PyExc_OverflowError,
- "unsigned short integer is greater than maximum");
+ "signed short integer is greater than maximum");
return converterr("integer<h>", arg, msgbuf, bufsize);
}
else