Core and Builtins
-----------------
+- Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.)
+ in the interpreter.
+
- Issue #17043: The unicode-internal decoder no longer read past the end of
input buffer.
size = 0;
len = 0;
while ((c = *s++) != '\0') {
- if (isspace(Py_CHARMASK(c)))
+ if (Py_ISSPACE(Py_CHARMASK(c)))
continue;
if ('0' <= c && c <= '9') {
num = c - '0';
s = fmt;
size = 0;
while ((c = *s++) != '\0') {
- if (isspace(Py_CHARMASK(c)))
+ if (Py_ISSPACE(Py_CHARMASK(c)))
continue;
if ('0' <= c && c <= '9') {
num = c - '0';
static int
to_int(int c)
{
- if (isdigit(c))
+ if (Py_ISDIGIT(c))
return c - '0';
else {
if (Py_ISUPPER(c))
if (strlen(msgbuf) > 0) { /* If Non-Empty Msg, Trim CRLF */
char *lastc = &msgbuf[ strlen(msgbuf)-1 ];
- while (lastc > msgbuf && isspace(Py_CHARMASK(*lastc)))
+ while (lastc > msgbuf && Py_ISSPACE(Py_CHARMASK(*lastc)))
*lastc-- = '\0'; /* Trim Trailing Whitespace (CRLF) */
}
/* If non-empty msg, trim CRLF */
char *lastc = &outbuf[ strlen(outbuf)-1 ];
while (lastc > outbuf &&
- isspace(Py_CHARMASK(*lastc))) {
+ Py_ISSPACE(Py_CHARMASK(*lastc))) {
/* Trim trailing whitespace (CRLF) */
*lastc-- = '\0';
}
"int() arg 2 must be >= 2 and <= 36");
return NULL;
}
- while (*str != '\0' && isspace(Py_CHARMASK(*str)))
+ while (*str != '\0' && Py_ISSPACE(Py_CHARMASK(*str)))
str++;
if (*str == '+')
++str;
goto onError;
if (sign < 0)
Py_SIZE(z) = -(Py_SIZE(z));
- while (*str && isspace(Py_CHARMASK(*str)))
+ while (*str && Py_ISSPACE(Py_CHARMASK(*str)))
str++;
if (*str != '\0')
goto onError;
STRINGLIB_CHAR *end = ptr + len;
STRINGLIB_CHAR *remainder;
- while (ptr<end && isdigit(*ptr))
+ while (ptr<end && Py_ISDIGIT(*ptr))
++ptr;
remainder = ptr;
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;
#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() */
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");
}
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 == '|')
}
}
- if (*format != '\0' && !isalpha(Py_CHARMASK(*format)) &&
+ if (*format != '\0' && !Py_ISALPHA(Py_CHARMASK(*format)) &&
*format != '(' &&
*format != '|' && *format != ':' && *format != ';') {
PyErr_Format(PyExc_SystemError,
}
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++;
}
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 */
/* skip all zeroes... */
while (*str == '0')
++str;
- while (isspace(Py_CHARMASK(*str)))
+ while (Py_ISSPACE(Py_CHARMASK(*str)))
++str;
if (ptr)
*ptr = str;
unsigned long uresult;
char sign;
- while (*str && isspace(Py_CHARMASK(*str)))
+ while (*str && Py_ISSPACE(Py_CHARMASK(*str)))
str++;
sign = *str;