Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.

I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag).
diff --git a/Python/ast.c b/Python/ast.c
index d2f063b..e395c5a 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -3305,7 +3305,7 @@
     int quote = Py_CHARMASK(*s);
     int rawmode = 0;
     int need_encoding;
-    if (isalpha(quote)) {
+    if (Py_ISALPHA(quote)) {
         if (quote == 'b' || quote == 'B') {
             quote = *++s;
             *bytesmode = 1;
diff --git a/Python/dynload_aix.c b/Python/dynload_aix.c
index 149990d..b025cd3 100644
--- a/Python/dynload_aix.c
+++ b/Python/dynload_aix.c
@@ -4,7 +4,6 @@
 #include "Python.h"
 #include "importdl.h"
 
-#include <ctype.h>      /*  for isdigit()         */
 #include <errno.h>      /*  for global errno      */
 #include <string.h>     /*  for strerror()        */
 #include <stdlib.h>     /*  for malloc(), free()  */
@@ -144,7 +143,7 @@
             if (nerr == load_errtab[j].errNo && load_errtab[j].errstr)
             ERRBUF_APPEND(load_errtab[j].errstr);
         }
-        while (isdigit(Py_CHARMASK(*message[i]))) message[i]++ ;
+        while (Py_ISDIGIT(Py_CHARMASK(*message[i]))) message[i]++ ;
         ERRBUF_APPEND(message[i]);
         ERRBUF_APPEND("\n");
     }
diff --git a/Python/getargs.c b/Python/getargs.c
index a77bb05..d588102 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -288,7 +288,7 @@
             if (level == 0) {
                 if (c == 'O')
                     max++;
-                else if (isalpha(Py_CHARMASK(c))) {
+                else if (Py_ISALPHA(Py_CHARMASK(c))) {
                     if (c != 'e') /* skip encoded */
                         max++;
                 } else if (c == '|')
@@ -378,7 +378,7 @@
         }
     }
 
-    if (*format != '\0' && !isalpha(Py_CHARMASK(*format)) &&
+    if (*format != '\0' && !Py_ISALPHA(Py_CHARMASK(*format)) &&
         *format != '(' &&
         *format != '|' && *format != ':' && *format != ';') {
         PyErr_Format(PyExc_SystemError,
@@ -471,7 +471,7 @@
         }
         else if (c == ':' || c == ';' || c == '\0')
             break;
-        else if (level == 0 && isalpha(Py_CHARMASK(c)))
+        else if (level == 0 && Py_ISALPHA(Py_CHARMASK(c)))
             n++;
     }
 
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index 52502cb..8a54cbf 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -99,7 +99,7 @@
     register int ovlimit;       /* required digits to overflow */
 
     /* skip leading white space */
-    while (*str && isspace(Py_CHARMASK(*str)))
+    while (*str && Py_ISSPACE(Py_CHARMASK(*str)))
         ++str;
 
     /* check for leading 0b, 0o or 0x for auto-base or base 16 */
@@ -138,7 +138,7 @@
                 /* skip all zeroes... */
                 while (*str == '0')
                     ++str;
-                while (isspace(Py_CHARMASK(*str)))
+                while (Py_ISSPACE(Py_CHARMASK(*str)))
                     ++str;
                 if (ptr)
                     *ptr = str;
@@ -266,7 +266,7 @@
     unsigned long uresult;
     char sign;
 
-    while (*str && isspace(Py_CHARMASK(*str)))
+    while (*str && Py_ISSPACE(Py_CHARMASK(*str)))
         str++;
 
     sign = *str;