Kaydet (Commit) 2b7953d9 authored tarafından Benjamin Peterson's avatar Benjamin Peterson Kaydeden (comit) GitHub

replace custom table with pyctype (#3456)

üst e3b2b4b8
...@@ -14,17 +14,6 @@ typedef struct { ...@@ -14,17 +14,6 @@ typedef struct {
static int static int
all_name_chars(PyObject *o) all_name_chars(PyObject *o)
{ {
/* [a-zA-Z0-9_] */
static const bool ok_name_char[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
};
const unsigned char *s, *e; const unsigned char *s, *e;
if (!PyUnicode_IS_ASCII(o)) if (!PyUnicode_IS_ASCII(o))
...@@ -33,7 +22,7 @@ all_name_chars(PyObject *o) ...@@ -33,7 +22,7 @@ all_name_chars(PyObject *o)
s = PyUnicode_1BYTE_DATA(o); s = PyUnicode_1BYTE_DATA(o);
e = s + PyUnicode_GET_LENGTH(o); e = s + PyUnicode_GET_LENGTH(o);
for (; s != e; s++) { for (; s != e; s++) {
if (!ok_name_char[*s]) if (!Py_ISALNUM(*s) && *s != '_')
return 0; return 0;
} }
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment