diff Python/getargs.c @ 28667:5bfdbc0fd172 legacy-trunk

Roll back changes to 'h' format code -- too much breaks. Other changes stay.
author Guido van Rossum <guido@python.org>
date Fri, 18 Apr 2003 00:12:30 +0000
parents 28a2975514cd
children 6c4a04ce965c
line wrap: on
line diff
--- a/Python/getargs.c	Thu Apr 17 23:09:08 2003 +0000
+++ b/Python/getargs.c	Fri Apr 18 00:12:30 2003 +0000
@@ -456,7 +456,7 @@
 		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 @@
 		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