Commit cee1011c authored by Stefan Behnel's avatar Stefan Behnel

remove an optimisation in the PEP393 code that can potentially break unicode comparisons

parent 3466713a
...@@ -7706,8 +7706,11 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int ...@@ -7706,8 +7706,11 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0); Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0); Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
} else if (PyUnicode_MAX_CHAR_VALUE(s1) != PyUnicode_MAX_CHAR_VALUE(s2)) { """
return (equals == Py_NE); ## currently disabled: may not be safe depending on who created the string
# } else if (PyUnicode_MAX_CHAR_VALUE(s1) != PyUnicode_MAX_CHAR_VALUE(s2)) {
# return (equals == Py_NE);
"""\
#else #else
if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
return (equals == Py_NE); return (equals == Py_NE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment