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/compile.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/compile.c')
-rw-r--r-- | Python/compile.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/compile.c b/Python/compile.c index c0c81e1..a8d7fcd 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1522,7 +1522,7 @@ get_ref_type(struct compiler *c, PyObject *name) { int scope; if (c->u->u_scope_type == COMPILER_SCOPE_CLASS && - !PyUnicode_CompareWithASCIIString(name, "__class__")) + _PyUnicode_EqualToASCIIString(name, "__class__")) return CELL; scope = PyST_GetScope(c->u->u_ste, name); if (scope == 0) { @@ -2688,7 +2688,7 @@ compiler_from_import(struct compiler *c, stmt_ty s) } if (s->lineno > c->c_future->ff_lineno && s->v.ImportFrom.module && - !PyUnicode_CompareWithASCIIString(s->v.ImportFrom.module, "__future__")) { + _PyUnicode_EqualToASCIIString(s->v.ImportFrom.module, "__future__")) { Py_DECREF(level); Py_DECREF(names); return compiler_error(c, "from __future__ imports must occur " @@ -3027,9 +3027,9 @@ compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx) if (!mangled) return 0; - assert(PyUnicode_CompareWithASCIIString(name, "None") && - PyUnicode_CompareWithASCIIString(name, "True") && - PyUnicode_CompareWithASCIIString(name, "False")); + assert(!_PyUnicode_EqualToASCIIString(name, "None") && + !_PyUnicode_EqualToASCIIString(name, "True") && + !_PyUnicode_EqualToASCIIString(name, "False")); op = 0; optype = OP_NAME; |