diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 08:19:20 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 08:19:20 (GMT) |
commit | 3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1 (patch) | |
tree | a1a58a83f9d60f7d5d02e5d116bb76ee13c42254 /Python/ast.c | |
parent | 21060105d99a9153db44dd88eb750965392fd966 (diff) | |
parent | f4934ea77da38516731a75fbf9458b248d26dd81 (diff) | |
download | cpython-3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1.zip cpython-3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1.tar.gz cpython-3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1.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; } |