summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-10-11 13:41:58 (GMT)
committerGitHub <noreply@github.com>2023-10-11 13:41:58 (GMT)
commiteb50cd37eac47dd4dc71ab42d0582dfb6eac4515 (patch)
tree410d6c0c88cb2c223cace999b490a6adce642e8f /Include
parentd1f7fae424d51b0374c8204599583c4a26c1a992 (diff)
downloadcpython-eb50cd37eac47dd4dc71ab42d0582dfb6eac4515.zip
cpython-eb50cd37eac47dd4dc71ab42d0582dfb6eac4515.tar.gz
cpython-eb50cd37eac47dd4dc71ab42d0582dfb6eac4515.tar.bz2
gh-110289: C API: Add PyUnicode_EqualToUTF8() and PyUnicode_EqualToUTF8AndSize() functions (GH-110297)
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index f002777..dee0071 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -957,6 +957,15 @@ PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString(
const char *right /* ASCII-encoded string */
);
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030D0000
+/* Compare a Unicode object with UTF-8 encoded C string.
+ Return 1 if they are equal, or 0 otherwise.
+ This function does not raise exceptions. */
+
+PyAPI_FUNC(int) PyUnicode_EqualToUTF8(PyObject *, const char *);
+PyAPI_FUNC(int) PyUnicode_EqualToUTF8AndSize(PyObject *, const char *, Py_ssize_t);
+#endif
+
/* Rich compare two strings and return one of the following:
- NULL in case an exception was raised