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:
Martin v. Löwis 2011-10-09 10:38:36 +02:00
parent 67df285a33
commit afe55bba33
50 changed files with 578 additions and 240 deletions

View file

@ -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;