From: Guido van Rossum Date: Wed, 23 Oct 1996 14:19:40 +0000 (+0000) Subject: Fixed compare function to do first char comparison in unsigned mode, X-Git-Tag: v1.4~47 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fde7a75b78ed29bc0b23c4df35587ade99a7ddf2;p=thirdparty%2FPython%2Fcpython.git Fixed compare function to do first char comparison in unsigned mode, for consistency with the way other characters are compared. --- diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 3dfe1154876d..f3063cf7800a 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)