Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3b2b4b commit 2b7953dCopy full SHA for 2b7953d
1 file changed
Objects/codeobject.c
@@ -14,17 +14,6 @@ typedef struct {
14
static int
15
all_name_chars(PyObject *o)
16
{
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
21
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
26
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
27
- };
28
const unsigned char *s, *e;
29
30
if (!PyUnicode_IS_ASCII(o))
@@ -33,7 +22,7 @@ all_name_chars(PyObject *o)
33
s = PyUnicode_1BYTE_DATA(o);
34
e = s + PyUnicode_GET_LENGTH(o);
35
for (; s != e; s++) {
36
- if (!ok_name_char[*s])
+ if (!Py_ISALNUM(*s) && *s != '_')
37
return 0;
38
}
39
return 1;
0 commit comments