Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 46149:7fdff02e6f45 legacy-trunk
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.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Fri, 28 Mar 2008 04:58:51 +0000 |
| parents | 5078b7ee16dc |
| children | 4e72489f16d0 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Fri Mar 28 04:53:10 2008 +0000 +++ b/Objects/unicodeobject.c Fri Mar 28 04:58:51 2008 +0000 @@ -480,13 +480,13 @@ /* 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;
