summaryrefslogtreecommitdiff
path: root/Python/ast.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-16 10:17:58 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-16 10:17:58 +0200
commit78779b765c2d7f89fab3868b77b6a6522c55ee4c (patch)
tree8df49348f2e40aeb09ab893822424a995f4764c9 /Python/ast.c
parentf3ba65bd7b8aee8b0351c6bf2f8fd000b165e7f5 (diff)
downloadcpython-78779b765c2d7f89fab3868b77b6a6522c55ee4c.tar.gz
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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 6da33f73a0..5b7ed7c035 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -876,14 +876,14 @@ 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 (full_checks) {
const char **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;
}