mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
PyUnicode_DecodeUTF8 will always return a ready string
This commit is contained in:
parent
8f56e0909f
commit
5eda913cd2
1 changed files with 2 additions and 1 deletions
|
@ -532,8 +532,9 @@ new_identifier(const char* n, PyArena *arena)
|
|||
{
|
||||
_Py_IDENTIFIER(normalize);
|
||||
PyObject* id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);
|
||||
if (!id || PyUnicode_READY(id) == -1)
|
||||
if (!id)
|
||||
return NULL;
|
||||
assert(PyUnicode_IS_READY(id));
|
||||
/* Check whether there are non-ASCII characters in the
|
||||
identifier; if so, normalize to NFKC. */
|
||||
if (PyUnicode_MAX_CHAR_VALUE((PyUnicodeObject *)id) >= 128) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue