cpython: 38830281d43b (original) (raw)
Mercurial > cpython
changeset 82110:38830281d43b 3.2
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). [#17173]
Antoine Pitrou solipsis@pitrou.net | |
---|---|
date | Sat, 09 Feb 2013 23:11:27 +0100 |
parents | cd59b398907d |
children | c08bcf5302ec c5f4fa02fc86 |
files | Misc/NEWS Modules/_struct.c Modules/binascii.c Modules/posixmodule.c Modules/socketmodule.c Objects/longobject.c Objects/stringlib/formatter.h Python/ast.c Python/dynload_aix.c Python/getargs.c Python/mystrtoul.c |
diffstat | 11 files changed, 19 insertions(+), 17 deletions(-)[+] [-] Misc/NEWS 3 Modules/_struct.c 4 Modules/binascii.c 2 Modules/posixmodule.c 2 Modules/socketmodule.c 2 Objects/longobject.c 4 Objects/stringlib/formatter.h 2 Python/ast.c 2 Python/dynload_aix.c 3 Python/getargs.c 6 Python/mystrtoul.c 6 |
line wrap: on
line diff
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.2.4 Core and Builtins ----------------- +- Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.)
--- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1184,7 +1184,7 @@ prepare_s(PyStructObject *self) size = 0; len = 0; while ((c = *s++) != '\0') {
if (isspace(Py_CHARMASK(c)))[](#l2.7)
if (Py_ISSPACE(Py_CHARMASK(c)))[](#l2.8) continue;[](#l2.9) if ('0' <= c && c <= '9') {[](#l2.10) num = c - '0';[](#l2.11)
@@ -1249,7 +1249,7 @@ prepare_s(PyStructObject *self) s = fmt; size = 0; while ((c = *s++) != '\0') {
if (isspace(Py_CHARMASK(c)))[](#l2.16)
if (Py_ISSPACE(Py_CHARMASK(c)))[](#l2.17) continue;[](#l2.18) if ('0' <= c && c <= '9') {[](#l2.19) num = c - '0';[](#l2.20)
--- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -1099,7 +1099,7 @@ This function is also available as "hex static int to_int(int c) {
--- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -695,7 +695,7 @@ os2_formatmsg(char msgbuf, int msglen, if (strlen(msgbuf) > 0) { / If Non-Empty Msg, Trim CRLF */ char *lastc = &msgbuf[ strlen(msgbuf)-1 ];
while (lastc > msgbuf && isspace(Py_CHARMASK(*lastc)))[](#l4.7)
}while (lastc > msgbuf && Py_ISSPACE(Py_CHARMASK(*lastc)))[](#l4.8) *lastc-- = '\0'; /* Trim Trailing Whitespace (CRLF) */[](#l4.9)
--- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -519,7 +519,7 @@ set_error(void) /* If non-empty msg, trim CRLF */ char *lastc = &outbuf[ strlen(outbuf)-1 ]; while (lastc > outbuf &&
isspace(Py_CHARMASK(*lastc))) {[](#l5.7)
Py_ISSPACE(Py_CHARMASK(*lastc))) {[](#l5.8) /* Trim trailing whitespace (CRLF) */[](#l5.9) *lastc-- = '\0';[](#l5.10) }[](#l5.11)
--- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1887,7 +1887,7 @@ PyLong_FromString(char *str, char **pend "int() arg 2 must be >= 2 and <= 36"); return NULL; }
@@ -2131,7 +2131,7 @@ digit beyond the first. goto onError; if (sign < 0) Py_SIZE(z) = -(Py_SIZE(z));
--- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -414,7 +414,7 @@ parse_number(STRINGLIB_CHAR *ptr, Py_ssi STRINGLIB_CHAR *end = ptr + len; STRINGLIB_CHAR *remainder;
--- a/Python/ast.c +++ b/Python/ast.c @@ -3305,7 +3305,7 @@ parsestr(struct compiling *c, const node int quote = Py_CHARMASK(*s); int rawmode = 0; int need_encoding;
--- 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 @@ 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]++ ;[](#l9.15)
}while (Py_ISDIGIT(Py_CHARMASK(*message[i]))) message[i]++ ;[](#l9.16) ERRBUF_APPEND(message[i]);[](#l9.17) ERRBUF_APPEND("\n");[](#l9.18)
--- a/Python/getargs.c +++ b/Python/getargs.c @@ -288,7 +288,7 @@ vgetargs1(PyObject *args, const char *fo if (level == 0) { if (c == 'O') max++;
else if (isalpha(Py_CHARMASK(c))) {[](#l10.7)
else if (Py_ISALPHA(Py_CHARMASK(c))) {[](#l10.8) if (c != 'e') /* skip encoded */[](#l10.9) max++;[](#l10.10) } else if (c == '|')[](#l10.11)
@@ -378,7 +378,7 @@ vgetargs1(PyObject *args, const char *fo } }
- if (*format != '\0' && !Py_ISALPHA(Py_CHARMASK(*format)) && *format != '(' && *format != '|' && *format != ':' && *format != ';') { PyErr_Format(PyExc_SystemError,
@@ -471,7 +471,7 @@ converttuple(PyObject *arg, const char * } else if (c == ':' || c == ';' || c == '\0') break;
else if (level == 0 && isalpha(Py_CHARMASK(c)))[](#l10.25)
--- a/Python/mystrtoul.c +++ b/Python/mystrtoul.c @@ -99,7 +99,7 @@ PyOS_strtoul(register char *str, char ** register int ovlimit; /* required digits to overflow / / skip leading white space */
/* check for leading 0b, 0o or 0x for auto-base or base 16 */ @@ -138,7 +138,7 @@ PyOS_strtoul(register char *str, char ** /* skip all zeroes... */ while (*str == '0') ++str;
while (isspace(Py_CHARMASK(*str)))[](#l11.16)
while (Py_ISSPACE(Py_CHARMASK(*str)))[](#l11.17) ++str;[](#l11.18) if (ptr)[](#l11.19) *ptr = str;[](#l11.20)
@@ -266,7 +266,7 @@ PyOS_strtol(char *str, char **ptr, int b unsigned long uresult; char sign;