mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Cast directly to unsigned char, instead of using Py_CHARMASK
We don't need "& 0xff" on an unsigned char.
This commit is contained in:
parent
9db1a8b69f
commit
9faa384bed
1 changed files with 2 additions and 2 deletions
|
@ -1652,8 +1652,8 @@ PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
|
||||||
|
|
||||||
/* Single characters are shared when using this constructor.
|
/* Single characters are shared when using this constructor.
|
||||||
Restrict to ASCII, since the input must be UTF-8. */
|
Restrict to ASCII, since the input must be UTF-8. */
|
||||||
if (size == 1 && Py_CHARMASK(*u) < 128)
|
if (size == 1 && (unsigned char)*u < 128)
|
||||||
return get_latin1_char(Py_CHARMASK(*u));
|
return get_latin1_char((unsigned char)*u);
|
||||||
|
|
||||||
return PyUnicode_DecodeUTF8(u, size, NULL);
|
return PyUnicode_DecodeUTF8(u, size, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue