[Python-checkins] cpython: Issue #19424: PyUnicode_CompareWithASCIIString() normalizes memcmp() result
victor.stinner
python-checkins at python.org
Mon Nov 4 11:29:12 CET 2013
http://hg.python.org/cpython/rev/494f736f5945
changeset: 86920:494f736f5945
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Nov 04 11:28:26 2013 +0100
summary:
Issue #19424: PyUnicode_CompareWithASCIIString() normalizes memcmp() result
to -1, 0, 1
files:
Objects/unicodeobject.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10584,8 +10584,12 @@
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)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list