diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 10:19:20 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-16 10:19:20 +0200 |
commit | c0797803c0d4303489709f02078c8c6adc4eed36 (patch) | |
tree | d3b5afe679e3030eecf9372a6c6bdee5bc5f39e0 /Include | |
parent | cf0a090abb7d7c2a3baf33a5183c0842dd316608 (diff) | |
parent | 78779b765c2d7f89fab3868b77b6a6522c55ee4c (diff) | |
download | cpython-c0797803c0d4303489709f02078c8c6adc4eed36.tar.gz |
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 b5ef3e4130..7b600893c6 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 |