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

@ -1643,6 +1643,9 @@ They all return *NULL* or ``-1`` if an exception occurs.
Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, and greater than,
respectively.
This function returns ``-1`` upon failure, so one should call
:c:func:`PyErr_Occurred` to check for errors.
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, const char *string)
@ -1651,6 +1654,9 @@ They all return *NULL* or ``-1`` if an exception occurs.
ASCII-encoded strings, but the function interprets the input string as
ISO-8859-1 if it contains non-ASCII characters.
This function returns ``-1`` upon failure, so one should call
:c:func:`PyErr_Occurred` to check for errors.
.. c:function:: PyObject* PyUnicode_RichCompare(PyObject *left, PyObject *right, int op)