diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-02-09 22:14:42 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-02-09 22:14:42 (GMT) |
commit | c73c561181c3ea3bf15c908a827878e1450a5ac6 (patch) | |
tree | f924a60b5c1b5aa172cf3eba2c39605789a7017c /Python | |
parent | 859cd4723f07e2b1da7387f5be0f2ce0a195974d (diff) | |
parent | 4de7457009d3dac9c93cc5b471d20a8d5e92ff33 (diff) | |
download | cpython-c73c561181c3ea3bf15c908a827878e1450a5ac6.zip cpython-c73c561181c3ea3bf15c908a827878e1450a5ac6.tar.gz cpython-c73c561181c3ea3bf15c908a827878e1450a5ac6.tar.bz2 |
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), mpdecimal (needs to build without Python.h).
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 2 | ||||
-rw-r--r-- | Python/dynload_aix.c | 3 | ||||
-rw-r--r-- | Python/formatter_unicode.c | 2 | ||||
-rw-r--r-- | Python/getargs.c | 6 | ||||
-rw-r--r-- | Python/mystrtoul.c | 6 |
5 files changed, 9 insertions, 10 deletions
diff --git a/Python/ast.c b/Python/ast.c index 7657b22..730c576 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3747,7 +3747,7 @@ parsestr(struct compiling *c, const node *n, int *bytesmode) int quote = Py_CHARMASK(*s); int rawmode = 0; int need_encoding; - if (isalpha(quote)) { + if (Py_ISALPHA(quote)) { while (!*bytesmode || !rawmode) { if (quote == 'b' || quote == 'B') { quote = *++s; diff --git a/Python/dynload_aix.c b/Python/dynload_aix.c index b4f71f2..f40a0be 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() */ @@ -141,7 +140,7 @@ aix_loaderror(const char *pathname) 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/formatter_unicode.c b/Python/formatter_unicode.c index aa62502..17eb978 100644 --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -401,7 +401,7 @@ parse_number(PyObject *s, Py_ssize_t pos, Py_ssize_t end, { Py_ssize_t remainder; - while (pos<end && isdigit(PyUnicode_READ_CHAR(s, pos))) + while (pos<end && Py_ISDIGIT(PyUnicode_READ_CHAR(s, pos))) ++pos; remainder = pos; diff --git a/Python/getargs.c b/Python/getargs.c index 18c8e91..ae931b9 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -244,7 +244,7 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags) 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 == '|') @@ -336,7 +336,7 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags) } } - if (*format != '\0' && !isalpha(Py_CHARMASK(*format)) && + if (*format != '\0' && !Py_ISALPHA(Py_CHARMASK(*format)) && *format != '(' && *format != '|' && *format != ':' && *format != ';') { PyErr_Format(PyExc_SystemError, @@ -429,7 +429,7 @@ converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags, } 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 @@ PyOS_strtoul(register char *str, char **ptr, int base) 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 @@ PyOS_strtoul(register char *str, char **ptr, int base) /* 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 @@ PyOS_strtol(char *str, char **ptr, int base) unsigned long uresult; char sign; - while (*str && isspace(Py_CHARMASK(*str))) + while (*str && Py_ISSPACE(Py_CHARMASK(*str))) str++; sign = *str; |