summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-23 18:06:00 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-23 18:06:00 (GMT)
commit9faa384bedd3ede3ece06ffe0e440a99f6e7e575 (patch)
tree9462e142eed2e08ba3885083552e6564991fceb8 /Objects/unicodeobject.c
parent9db1a8b69f13f884336556b61252f7ca271f2b76 (diff)
downloadcpython-9faa384bedd3ede3ece06ffe0e440a99f6e7e575.zip
cpython-9faa384bedd3ede3ece06ffe0e440a99f6e7e575.tar.gz
cpython-9faa384bedd3ede3ece06ffe0e440a99f6e7e575.tar.bz2
Cast directly to unsigned char, instead of using Py_CHARMASK
We don't need "& 0xff" on an unsigned char.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 43ecd5d..58f657e 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);
}