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/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++;
}