mirror of
https://github.com/python/cpython.git
synced 2025-11-09 01:51:26 +00:00
gh-124502: Add PyUnicode_Equal() function (#124504)
This commit is contained in:
parent
c5df1cb7bd
commit
a7f0727ca5
11 changed files with 111 additions and 2 deletions
|
|
@ -1438,6 +1438,31 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
|
|||
This function returns ``-1`` upon failure, so one should call
|
||||
:c:func:`PyErr_Occurred` to check for errors.
|
||||
|
||||
.. seealso::
|
||||
|
||||
The :c:func:`PyUnicode_Equal` function.
|
||||
|
||||
|
||||
.. c:function:: int PyUnicode_Equal(PyObject *a, PyObject *b)
|
||||
|
||||
Test if two strings are equal:
|
||||
|
||||
* Return ``1`` if *a* is equal to *b*.
|
||||
* Return ``0`` if *a* is not equal to *b*.
|
||||
* Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not a
|
||||
:class:`str` object.
|
||||
|
||||
The function always succeeds if *a* and *b* are :class:`str` objects.
|
||||
|
||||
The function works for :class:`str` subclasses, but does not honor custom
|
||||
``__eq__()`` method.
|
||||
|
||||
.. seealso::
|
||||
|
||||
The :c:func:`PyUnicode_Compare` function.
|
||||
|
||||
.. versionadded:: 3.14
|
||||
|
||||
|
||||
.. c:function:: int PyUnicode_EqualToUTF8AndSize(PyObject *unicode, const char *string, Py_ssize_t size)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue