[Python-checkins] cpython: Cast directly to unsigned char, instead of using Py_CHARMASK

victor.stinner python-checkins at python.org
Sat Oct 29 02:01:00 CEST 2011


http://hg.python.org/cpython/rev/60798098e863
changeset:   73186:60798098e863
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Sun Oct 23 20:06:00 2011 +0200
summary:
  Cast directly to unsigned char, instead of using Py_CHARMASK

We don't need "& 0xff" on an unsigned char.

files:
  Objects/unicodeobject.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1652,8 +1652,8 @@
 
         /* 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);
     }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list