aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-16 10:19:20 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-16 10:19:20 +0200
commit3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1 (patch)
treea1a58a83f9d60f7d5d02e5d116bb76ee13c42254 /Include/unicodeobject.h
parentIssue #26935: Fix broken Android dup2() in test_os (diff)
parentIssue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualT... (diff)
downloadcpython-3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1.tar.gz
cpython-3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1.tar.bz2
cpython-3b73ea127892d0e1f9d8f12f88e4f9c0ba0b89b1.zip
Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index b5ef3e41303..7b600893c6a 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