Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2b6727b

Browse files
committed
Use Py_CHARMASK for ctype macros. Fixes bug #232787.
1 parent a30c100 commit 2b6727b

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

Modules/timemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ time_strptime(PyObject *self, PyObject *args)
397397
PyErr_SetString(PyExc_ValueError, "format mismatch");
398398
return NULL;
399399
}
400-
while (*s && isspace(*s))
400+
while (*s && isspace(Py_CHARMASK(*s)))
401401
s++;
402402
if (*s) {
403403
PyErr_Format(PyExc_ValueError,

Objects/intobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ PyInt_FromString(char *s, char **pend, int base)
182182
x = (long) PyOS_strtoul(s, &end, base);
183183
else
184184
x = PyOS_strtol(s, &end, base);
185-
if (end == s || !isalnum(end[-1]))
185+
if (end == s || !isalnum(Py_CHARMASK(end[-1])))
186186
goto bad;
187187
while (*end && isspace(Py_CHARMASK(*end)))
188188
end++;

Python/errors.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ PyErr_Format(PyObject *exception, const char *format, ...)
402402
for (f = format; *f; f++) {
403403
if (*f == '%') {
404404
const char* p = f;
405-
while (*++f && *f != '%' && !isalpha(*f))
405+
while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*f)))
406406
;
407407
switch (*f) {
408408
case 'c':
@@ -457,15 +457,15 @@ PyErr_Format(PyObject *exception, const char *format, ...)
457457
/* parse the width.precision part (we're only
458458
interested in the precision value, if any) */
459459
n = 0;
460-
while (isdigit(*f))
460+
while (isdigit(Py_CHARMASK(*f)))
461461
n = (n*10) + *f++ - '0';
462462
if (*f == '.') {
463463
f++;
464464
n = 0;
465-
while (isdigit(*f))
465+
while (isdigit(Py_CHARMASK(*f)))
466466
n = (n*10) + *f++ - '0';
467467
}
468-
while (*f && *f != '%' && !isalpha(*f))
468+
while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f)))
469469
f++;
470470
switch (*f) {
471471
case 'c':

0 commit comments

Comments
 (0)