mirror of
https://github.com/python/cpython.git
synced 2025-07-14 23:05:17 +00:00
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:
parent
5ebff7b300
commit
f4934ea77d
21 changed files with 120 additions and 75 deletions
|
@ -2011,6 +2011,17 @@ PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString(
|
|||
const char *right /* ASCII-encoded string */
|
||||
);
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
/* Test whether a unicode is equal to ASCII string. Return 1 if true,
|
||||
0 otherwise. Return 0 if any argument contains non-ASCII characters.
|
||||
Any error occurs inside will be cleared before return. */
|
||||
|
||||
PyAPI_FUNC(int) _PyUnicode_EqualToASCIIString(
|
||||
PyObject *left,
|
||||
const char *right /* ASCII-encoded string */
|
||||
);
|
||||
#endif
|
||||
|
||||
/* Rich compare two strings and return one of the following:
|
||||
|
||||
- NULL in case an exception was raised
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue