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 /Include | |
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 'Include')
-rw-r--r-- | Include/unicodeobject.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index b5ef3e4..7b60089 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2048,6 +2048,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 |