From: Victor Stinner Date: Sun, 23 Oct 2011 18:06:00 +0000 (+0200) Subject: Cast directly to unsigned char, instead of using Py_CHARMASK X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9faa384bedd3ede3ece06ffe0e440a99f6e7e575;p=python Cast directly to unsigned char, instead of using Py_CHARMASK We don't need "& 0xff" on an unsigned char. --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 43ecd5dde8..58f657e1e1 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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); }