@@ -1514,6 +1514,38 @@ static inline int PyLong_GetSign(PyObject *obj, int *sign)
15141514#endif
15151515
15161516
1517+ // gh-124502 added PyUnicode_Equal() to Python 3.14.0a0
1518+ #if PY_VERSION_HEX < 0x030E00A0
1519+ static inline int PyUnicode_Equal (PyObject *str1, PyObject *str2)
1520+ {
1521+ if (!PyUnicode_Check (str1)) {
1522+ PyErr_Format (PyExc_TypeError,
1523+ " first argument must be str, not %s" ,
1524+ Py_TYPE (str1)->tp_name );
1525+ return -1 ;
1526+ }
1527+ if (!PyUnicode_Check (str2)) {
1528+ PyErr_Format (PyExc_TypeError,
1529+ " second argument must be str, not %s" ,
1530+ Py_TYPE (str2)->tp_name );
1531+ return -1 ;
1532+ }
1533+
1534+ #if PY_VERSION_HEX >= 0x030d0000 && !defined(PYPY_VERSION)
1535+ extern int _PyUnicode_Equal (PyObject *str1, PyObject *str2);
1536+
1537+ return _PyUnicode_Equal (str1, str2);
1538+ #elif PY_VERSION_HEX >= 0x03060000 && !defined(PYPY_VERSION)
1539+ return _PyUnicode_EQ (str1, str2);
1540+ #elif PY_VERSION_HEX >= 0x03090000 && defined(PYPY_VERSION)
1541+ return _PyUnicode_EQ (str1, str2);
1542+ #else
1543+ return (PyUnicode_Compare (str1, str2) == 0 );
1544+ #endif
1545+ }
1546+ #endif
1547+
1548+
15171549#ifdef __cplusplus
15181550}
15191551#endif
0 commit comments