gh-124502: Add PyUnicode_Equal() function (#124504)

This commit is contained in:
Victor Stinner 2024-10-07 23:24:53 +02:00 committed by GitHub
parent c5df1cb7bd
commit a7f0727ca5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 111 additions and 2 deletions

View file

@ -11001,6 +11001,24 @@ _PyUnicode_Equal(PyObject *str1, PyObject *str2)
}
int
PyUnicode_Equal(PyObject *str1, PyObject *str2)
{
if (!PyUnicode_Check(str1)) {
PyErr_Format(PyExc_TypeError,
"first argument must be str, not %T", str1);
return -1;
}
if (!PyUnicode_Check(str2)) {
PyErr_Format(PyExc_TypeError,
"second argument must be str, not %T", str2);
return -1;
}
return _PyUnicode_Equal(str1, str2);
}
int
PyUnicode_Compare(PyObject *left, PyObject *right)
{