summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-03-28 04:58:51 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2008-03-28 04:58:51 (GMT)
commitd183bdd6fb77ae562714c655f0689beacdc00da1 (patch)
treefefb66dad02e0e67e3060459b4501a70f455eb00 /Objects/unicodeobject.c
parent36550bdde947ef7cad57d1375fbcf6096b017231 (diff)
downloadcpython-d183bdd6fb77ae562714c655f0689beacdc00da1.zip
cpython-d183bdd6fb77ae562714c655f0689beacdc00da1.tar.gz
cpython-d183bdd6fb77ae562714c655f0689beacdc00da1.tar.bz2
Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings.
Rather than sprinkle casts throughout the code, change Py_CHARMASK to always cast it's result to an unsigned char. This should ensure we do the right thing when accessing an array with the result.
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 317d03b..c5acd1b 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -480,13 +480,13 @@ PyObject *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) {
- unicode = unicode_latin1[(unsigned)Py_CHARMASK(*u)];
+ unicode = unicode_latin1[Py_CHARMASK(*u)];
if (!unicode) {
unicode = _PyUnicode_New(1);
if (!unicode)
return NULL;
unicode->str[0] = Py_CHARMASK(*u);
- unicode_latin1[(unsigned)Py_CHARMASK(*u)] = unicode;
+ unicode_latin1[Py_CHARMASK(*u)] = unicode;
}
Py_INCREF(unicode);
return (PyObject *)unicode;