]> granicus.if.org Git - python/commitdiff
Fixed compare function to do first char comparison in unsigned mode,
authorGuido van Rossum <guido@python.org>
Wed, 23 Oct 1996 14:19:40 +0000 (14:19 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 23 Oct 1996 14:19:40 +0000 (14:19 +0000)
for consistency with the way other characters are compared.

Objects/stringobject.c

index 3dfe1154876daa6a391033ee784087d7fe5b18e0..f3063cf7800adcf62ac091874444c7f61f12f2a4 100644 (file)
@@ -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)