]> granicus.if.org Git - python/commitdiff
Cast directly to unsigned char, instead of using Py_CHARMASK
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 23 Oct 2011 18:06:00 +0000 (20:06 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 23 Oct 2011 18:06:00 +0000 (20:06 +0200)
We don't need "& 0xff" on an unsigned char.

Objects/unicodeobject.c

index 43ecd5dde83d2f5b70e02b8830c0a0dfc9001f3d..58f657e1e1a9fe823b7b1077cbd0fe391c7fd4e9 100644 (file)
@@ -1652,8 +1652,8 @@ PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
 
         /* Single characters are shared when using this constructor.
            Restrict to ASCII, since the input must be UTF-8. */
-        if (size == 1 && Py_CHARMASK(*u) < 128)
-            return get_latin1_char(Py_CHARMASK(*u));
+        if (size == 1 && (unsigned char)*u < 128)
+            return get_latin1_char((unsigned char)*u);
 
         return PyUnicode_DecodeUTF8(u, size, NULL);
     }