Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.

The latter function is more readable, faster and doesn't raise exceptions.
This commit is contained in:
Serhiy Storchaka 2016-11-16 10:19:20 +02:00
commit 3b73ea1278
22 changed files with 125 additions and 80 deletions

View file

@ -586,7 +586,7 @@ _PyModule_ClearDict(PyObject *d)
while (PyDict_Next(d, &pos, &key, &value)) {
if (value != Py_None && PyUnicode_Check(key)) {
if (PyUnicode_READ_CHAR(key, 0) != '_' ||
PyUnicode_CompareWithASCIIString(key, "__builtins__") != 0)
!_PyUnicode_EqualToASCIIString(key, "__builtins__"))
{
if (Py_VerboseFlag > 1) {
const char *s = _PyUnicode_AsString(key);