Fix SF bug #1072182, problems with signed characters.

Most of these can be backported.
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c
index 5e4a9f7..758c4ee 100644
--- a/Modules/_hotshot.c
+++ b/Modules/_hotshot.c
@@ -1396,7 +1396,7 @@
     char *buffer;
     int i = 0;
 
-    while (*rev && !isdigit((int)*rev))
+    while (*rev && !isdigit(Py_CHARMASK(*rev)))
         ++rev;
     while (rev[i] != ' ' && rev[i] != '\0')
         ++i;
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index dd1620a..b898249 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -636,7 +636,7 @@
 	}
 
 	strcpy(argv0, className);
-	if (isupper((int)(argv0[0])))
+	if (isupper(Py_CHARMASK((argv0[0]))))
 		argv0[0] = tolower(argv0[0]);
 	Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
 	ckfree(argv0);
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index a08058f..b783573 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -463,7 +463,7 @@
     if (strlen(msgbuf) > 0) { /* If Non-Empty Msg, Trim CRLF */
         char *lastc = &msgbuf[ strlen(msgbuf)-1 ];
 
-        while (lastc > msgbuf && isspace(*lastc))
+        while (lastc > msgbuf && isspace(Py_CHARMASK(*lastc)))
             *lastc-- = '\0'; /* Trim Trailing Whitespace (CRLF) */
     }
 
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index ca2a850..c827581 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1803,7 +1803,7 @@
     char *rev = rcsid;
     int i = 0;
 
-    while (!isdigit((int)*rev))
+    while (!isdigit(Py_CHARMASK(*rev)))
         ++rev;
     while (rev[i] != ' ' && rev[i] != '\0')
         ++i;
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 3391405..038bd1f 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -506,7 +506,8 @@
 			if (strlen(outbuf) > 0) {
 				/* If non-empty msg, trim CRLF */
 				char *lastc = &outbuf[ strlen(outbuf)-1 ];
-				while (lastc > outbuf && isspace(*lastc)) {
+				while (lastc > outbuf &&
+				       isspace(Py_CHARMASK(*lastc))) {
 					/* Trim trailing whitespace (CRLF) */
 					*lastc-- = '\0';
 				}
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index ce19a05..ed72a71 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -757,7 +757,7 @@
 		x = (long) PyOS_strtoul(s, &end, base);
 	else
 		x = PyOS_strtol(s, &end, base);
-	if (end == s || !isalnum((int)end[-1]))
+	if (end == s || !isalnum(Py_CHARMASK(end[-1])))
 		goto bad;
 	while (*end && isspace(Py_CHARMASK(*end)))
 		end++;