Skip to content

Commit b8ba9d9

Browse files
committed
Handle PyUnicode_Compare() failure
1 parent 8e5bfdf commit b8ba9d9

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎pythoncapi_compat.h‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,16 @@ static inline int PyUnicode_Equal(PyObject *str1, PyObject *str2)
16121612
#elif PY_VERSION_HEX >= 0x03090000 && defined(PYPY_VERSION) && !defined(Py_LIMITED_API)
16131613
return _PyUnicode_EQ(str1, str2);
16141614
#else
1615-
return (PyUnicode_Compare(str1, str2) == 0);
1615+
{
1616+
int res = PyUnicode_Compare(str1, str2);
1617+
if (res == 0) {
1618+
return 1;
1619+
}
1620+
if (res > 0) {
1621+
return 0;
1622+
}
1623+
return -1;
1624+
}
16161625
#endif
16171626
}
16181627
#endif

0 commit comments

Comments
 (0)