summaryrefslogtreecommitdiffstats
path: root/Python/ast.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-16 08:19:20 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-16 08:19:20 (GMT)
commit3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1 (patch)
treea1a58a83f9d60f7d5d02e5d116bb76ee13c42254 /Python/ast.c
parent21060105d99a9153db44dd88eb750965392fd966 (diff)
parentf4934ea77da38516731a75fbf9458b248d26dd81 (diff)
downloadcpython-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.c8
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;
}