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:17:58 +02:00
parent 5ebff7b300
commit f4934ea77d
21 changed files with 120 additions and 75 deletions

View file

@ -1023,7 +1023,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
else if (PyUnicode_Check(res)) {
encodefuncentry *e = encodefuncs;
while (e->name != NULL) {
if (!PyUnicode_CompareWithASCIIString(res, e->name)) {
if (_PyUnicode_EqualToASCIIString(res, e->name)) {
self->encodefunc = e->encodefunc;
break;
}