summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-10-23 14:19:40 (GMT)
committerGuido van Rossum <guido@python.org>1996-10-23 14:19:40 (GMT)
commitfde7a75b78ed29bc0b23c4df35587ade99a7ddf2 (patch)
treed0b70d14f5421e73ec5a4a0948570abd7bf483ee
parent149574767c2125159e06d9c9ca381c0eb6f05ea7 (diff)
downloadcpython-fde7a75b78ed29bc0b23c4df35587ade99a7ddf2.zip
cpython-fde7a75b78ed29bc0b23c4df35587ade99a7ddf2.tar.gz
cpython-fde7a75b78ed29bc0b23c4df35587ade99a7ddf2.tar.bz2
Fixed compare function to do first char comparison in unsigned mode,
for consistency with the way other characters are compared.
-rw-r--r--Objects/stringobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 3dfe115..f3063cf 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -394,7 +394,7 @@ string_compare(a, b)
int min_len = (len_a < len_b) ? len_a : len_b;
int cmp;
if (min_len > 0) {
- cmp = *a->ob_sval - *b->ob_sval;
+ cmp = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval);
if (cmp == 0)
cmp = memcmp(a->ob_sval, b->ob_sval, min_len);
if (cmp != 0)