mirror of
https://github.com/python/cpython.git
synced 2025-09-08 18:01:44 +00:00
Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
This commit is contained in:
parent
67df285a33
commit
afe55bba33
50 changed files with 578 additions and 240 deletions
|
@ -527,6 +527,7 @@ static PyObject *parsestrplus(struct compiling *, const node *n,
|
|||
static identifier
|
||||
new_identifier(const char* n, PyArena *arena)
|
||||
{
|
||||
_Py_identifier(normalize);
|
||||
PyObject* id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);
|
||||
if (!id || PyUnicode_READY(id) == -1)
|
||||
return NULL;
|
||||
|
@ -537,7 +538,7 @@ new_identifier(const char* n, PyArena *arena)
|
|||
PyObject *id2;
|
||||
if (!m)
|
||||
return NULL;
|
||||
id2 = PyObject_CallMethod(m, "normalize", "sO", "NFKC", id);
|
||||
id2 = _PyObject_CallMethodId(m, &PyId_normalize, "sO", "NFKC", id);
|
||||
Py_DECREF(m);
|
||||
if (!id2)
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue