Kaydet (Commit) 21ea21ef authored tarafından Victor Stinner's avatar Victor Stinner

Issue #19424: PyUnicode_CompareWithASCIIString() normalizes memcmp() result

to -1, 0, 1
üst f0c7b2af
......@@ -10584,8 +10584,12 @@ PyUnicode_CompareWithASCIIString(PyObject* uni, const char* str)
len = Py_MIN(len1, len2);
cmp = memcmp(data, str, len);
if (cmp != 0)
return cmp;
if (cmp != 0) {
if (cmp < 0)
return -1;
else
return 1;
}
if (len1 > len2)
return 1; /* uni is longer */
if (len2 > len1)
......
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