diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 08:19:57 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 08:19:57 (GMT) |
commit | 1a73bf365e9664f8dd3357ebbb78ceaa79df2172 (patch) | |
tree | 87917a1a572c2f3c5a574d6a96a9879970a941d9 /Python/ast.c | |
parent | 1e2784e0b3cb8d9050bffb338b2de838fbba13a2 (diff) | |
parent | 3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1 (diff) | |
download | cpython-1a73bf365e9664f8dd3357ebbb78ceaa79df2172.zip cpython-1a73bf365e9664f8dd3357ebbb78ceaa79df2172.tar.gz cpython-1a73bf365e9664f8dd3357ebbb78ceaa79df2172.tar.bz2 |
Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/ast.c b/Python/ast.c index 14bcdb1..33b7df6 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -934,12 +934,12 @@ forbidden_name(struct compiling *c, identifier name, const node *n, int full_checks) { assert(PyUnicode_Check(name)); - if (PyUnicode_CompareWithASCIIString(name, "__debug__") == 0) { + if (_PyUnicode_EqualToASCIIString(name, "__debug__")) { ast_error(c, n, "assignment to keyword"); return 1; } - if (PyUnicode_CompareWithASCIIString(name, "async") == 0 || - PyUnicode_CompareWithASCIIString(name, "await") == 0) + if (_PyUnicode_EqualToASCIIString(name, "async") || + _PyUnicode_EqualToASCIIString(name, "await")) { PyObject *message = PyUnicode_FromString( "'async' and 'await' will become reserved keywords" @@ -963,7 +963,7 @@ forbidden_name(struct compiling *c, identifier name, const node *n, if (full_checks) { const char * const *p; for (p = FORBIDDEN; *p; p++) { - if (PyUnicode_CompareWithASCIIString(name, *p) == 0) { + if (_PyUnicode_EqualToASCIIString(name, *p)) { ast_error(c, n, "assignment to keyword"); return 1; } |