diff Python/getargs.c @ 36090:8cb686dd6e64 legacy-trunk

Fix SF bug #1072182, problems with signed characters. Most of these can be backported.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 19 Dec 2005 06:05:18 +0000
parents 9541369b0dca
children b8b3782b2dc0
line wrap: on
line diff
--- a/Python/getargs.c	Mon Dec 19 04:27:42 2005 +0000
+++ b/Python/getargs.c	Mon Dec 19 06:05:18 2005 +0000
@@ -166,7 +166,7 @@
 			if (level == 0) {
 				if (c == 'O')
 					max++;
-				else if (isalpha(c)) {
+				else if (isalpha(Py_CHARMASK(c))) {
 					if (c != 'e') /* skip encoded */
 						max++;
 				} else if (c == '|')
@@ -255,7 +255,7 @@
 		}
 	}
 
-	if (*format != '\0' && !isalpha((int)(*format)) &&
+	if (*format != '\0' && !isalpha(Py_CHARMASK((*format))) &&
 	    *format != '(' &&
 	    *format != '|' && *format != ':' && *format != ';') {
 		PyErr_Format(PyExc_SystemError,
@@ -347,7 +347,7 @@
 		}
 		else if (c == ':' || c == ';' || c == '\0')
 			break;
-		else if (level == 0 && isalpha(c))
+		else if (level == 0 && isalpha(Py_CHARMASK(c)))
 			n++;
 	}
 	
@@ -1223,7 +1223,7 @@
 	min = -1;
 	max = 0;
 	while ((i = *format++) != '\0') {
-		if (isalpha(i) && i != 'e') {
+		if (isalpha(Py_CHARMASK(i)) && i != 'e') {
 			max++;
 			if (*p == NULL) {
 				PyErr_SetString(PyExc_RuntimeError,