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

Skip to content

Commit 2b7953d

Browse files
authored
replace custom table with pyctype (#3456)
1 parent e3b2b4b commit 2b7953d

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

Objects/codeobject.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ typedef struct {
1414
static int
1515
all_name_chars(PyObject *o)
1616
{
17-
/* [a-zA-Z0-9_] */
18-
static const bool ok_name_char[128] = {
19-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
20-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
23-
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
24-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
25-
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
26-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
27-
};
2817
const unsigned char *s, *e;
2918

3019
if (!PyUnicode_IS_ASCII(o))
@@ -33,7 +22,7 @@ all_name_chars(PyObject *o)
3322
s = PyUnicode_1BYTE_DATA(o);
3423
e = s + PyUnicode_GET_LENGTH(o);
3524
for (; s != e; s++) {
36-
if (!ok_name_char[*s])
25+
if (!Py_ISALNUM(*s) && *s != '_')
3726
return 0;
3827
}
3928
return 1;

0 commit comments

Comments
 (0)