mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Fix warnings about using char as an array subscript. This is not portable
since char is signed on some platforms and unsigned on others.
This commit is contained in:
parent
4ebd46a02d
commit
231346e23f
4 changed files with 22 additions and 22 deletions
|
@ -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[Py_CHARMASK(*u)];
|
||||
unicode = unicode_latin1[(unsigned)Py_CHARMASK(*u)];
|
||||
if (!unicode) {
|
||||
unicode = _PyUnicode_New(1);
|
||||
if (!unicode)
|
||||
return NULL;
|
||||
unicode->str[0] = Py_CHARMASK(*u);
|
||||
unicode_latin1[Py_CHARMASK(*u)] = unicode;
|
||||
unicode_latin1[(unsigned)Py_CHARMASK(*u)] = unicode;
|
||||
}
|
||||
Py_INCREF(unicode);
|
||||
return (PyObject *)unicode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue