Skip to content

Commit 2ec7010

Browse files
qigangxuzooba
authored andcommitted
bpo-37752: Delete redundant Py_CHARMASK in normalizestring() (pythonGH-15095)
1 parent 801f925 commit 2ec7010

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

Modules/_struct.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ prepare_s(PyStructObject *self)
12981298
len = 0;
12991299
ncodes = 0;
13001300
while ((c = *s++) != '\0') {
1301-
if (Py_ISSPACE(Py_CHARMASK(c)))
1301+
if (Py_ISSPACE(c))
13021302
continue;
13031303
if ('0' <= c && c <= '9') {
13041304
num = c - '0';
@@ -1363,7 +1363,7 @@ prepare_s(PyStructObject *self)
13631363
s = fmt;
13641364
size = 0;
13651365
while ((c = *s++) != '\0') {
1366-
if (Py_ISSPACE(Py_CHARMASK(c)))
1366+
if (Py_ISSPACE(c))
13671367
continue;
13681368
if ('0' <= c && c <= '9') {
13691369
num = c - '0';

Modules/_tkinter.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ Tkapp_New(const char *screenName, const char *className,
671671
}
672672

673673
strcpy(argv0, className);
674-
if (Py_ISUPPER(Py_CHARMASK(argv0[0])))
675-
argv0[0] = Py_TOLOWER(Py_CHARMASK(argv0[0]));
674+
if (Py_ISUPPER(argv0[0]))
675+
argv0[0] = Py_TOLOWER(argv0[0]);
676676
Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
677677
PyMem_Free(argv0);
678678

Modules/unicodedata.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ _gethash(const char *s, int len, int scale)
987987
unsigned long h = 0;
988988
unsigned long ix;
989989
for (i = 0; i < len; i++) {
990-
h = (h * scale) + (unsigned char) Py_TOUPPER(Py_CHARMASK(s[i]));
990+
h = (h * scale) + (unsigned char) Py_TOUPPER(s[i]);
991991
ix = h & 0xff000000;
992992
if (ix)
993993
h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff;
@@ -1157,7 +1157,7 @@ _cmpname(PyObject *self, int code, const char* name, int namelen)
11571157
if (!_getucname(self, code, buffer, NAME_MAXLEN, 1))
11581158
return 0;
11591159
for (i = 0; i < namelen; i++) {
1160-
if (Py_TOUPPER(Py_CHARMASK(name[i])) != buffer[i])
1160+
if (Py_TOUPPER(name[i]) != buffer[i])
11611161
return 0;
11621162
}
11631163
return buffer[namelen] == '\0';

Objects/longobject.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,7 @@ PyLong_FromString(const char *str, char **pend, int base)
23002300
"int() arg 2 must be >= 2 and <= 36");
23012301
return NULL;
23022302
}
2303-
while (*str != '\0' && Py_ISSPACE(Py_CHARMASK(*str))) {
2303+
while (*str != '\0' && Py_ISSPACE(*str)) {
23042304
str++;
23052305
}
23062306
if (*str == '+') {
@@ -2609,7 +2609,7 @@ digit beyond the first.
26092609
if (sign < 0) {
26102610
Py_SIZE(z) = -(Py_SIZE(z));
26112611
}
2612-
while (*str && Py_ISSPACE(Py_CHARMASK(*str))) {
2612+
while (*str && Py_ISSPACE(*str)) {
26132613
str++;
26142614
}
26152615
if (*str != '\0') {

Python/dynload_aix.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ aix_loaderror(const char *pathname)
140140
if (nerr == load_errtab[j].errNo && load_errtab[j].errstr)
141141
ERRBUF_APPEND(load_errtab[j].errstr);
142142
}
143-
while (Py_ISDIGIT(Py_CHARMASK(*message[i]))) message[i]++ ;
143+
while (Py_ISDIGIT(*message[i])) message[i]++ ;
144144
ERRBUF_APPEND(message[i]);
145145
ERRBUF_APPEND("\n");
146146
}

Python/getargs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ vgetargs1_impl(PyObject *compat_args, PyObject *const *stack, Py_ssize_t nargs,
312312
break;
313313
default:
314314
if (level == 0) {
315-
if (Py_ISALPHA(Py_CHARMASK(c)))
315+
if (Py_ISALPHA(c))
316316
if (c != 'e') /* skip encoded */
317317
max++;
318318
}
@@ -397,7 +397,7 @@ vgetargs1_impl(PyObject *compat_args, PyObject *const *stack, Py_ssize_t nargs,
397397
}
398398
}
399399

400-
if (*format != '\0' && !Py_ISALPHA(Py_CHARMASK(*format)) &&
400+
if (*format != '\0' && !Py_ISALPHA(*format) &&
401401
*format != '(' &&
402402
*format != '|' && *format != ':' && *format != ';') {
403403
PyErr_Format(PyExc_SystemError,
@@ -521,7 +521,7 @@ converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
521521
}
522522
else if (c == ':' || c == ';' || c == '\0')
523523
break;
524-
else if (level == 0 && Py_ISALPHA(Py_CHARMASK(c)))
524+
else if (level == 0 && Py_ISALPHA(c))
525525
n++;
526526
}
527527

Python/mystrtoul.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ PyOS_strtoul(const char *str, char **ptr, int base)
9999
int ovlimit; /* required digits to overflow */
100100

101101
/* skip leading white space */
102-
while (*str && Py_ISSPACE(Py_CHARMASK(*str)))
102+
while (*str && Py_ISSPACE(*str))
103103
++str;
104104

105105
/* check for leading 0b, 0o or 0x for auto-base or base 16 */
@@ -138,7 +138,7 @@ PyOS_strtoul(const char *str, char **ptr, int base)
138138
/* skip all zeroes... */
139139
while (*str == '0')
140140
++str;
141-
while (Py_ISSPACE(Py_CHARMASK(*str)))
141+
while (Py_ISSPACE(*str))
142142
++str;
143143
if (ptr)
144144
*ptr = (char *)str;
@@ -266,7 +266,7 @@ PyOS_strtol(const char *str, char **ptr, int base)
266266
unsigned long uresult;
267267
char sign;
268268

269-
while (*str && Py_ISSPACE(Py_CHARMASK(*str)))
269+
while (*str && Py_ISSPACE(*str))
270270
str++;
271271

272272
sign = *str;

0 commit comments

Comments
 (0)