summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-04 10:28:26 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-04 10:28:26 (GMT)
commit21ea21ef6db731a8cac14fcd0c1a12c5c44496f4 (patch)
tree0ce7c0b565c0aa10ed79180b153ac79a1b3c2317 /Objects
parentf0c7b2af0552a4810aa4f879ca90b2706350d192 (diff)
downloadcpython-21ea21ef6db731a8cac14fcd0c1a12c5c44496f4.zip
cpython-21ea21ef6db731a8cac14fcd0c1a12c5c44496f4.tar.gz
cpython-21ea21ef6db731a8cac14fcd0c1a12c5c44496f4.tar.bz2
Issue #19424: PyUnicode_CompareWithASCIIString() normalizes memcmp() result
to -1, 0, 1
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 154103d..574b57a 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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)