summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-10-09 08:38:36 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-10-09 08:38:36 (GMT)
commitafe55bba33a20f87a58f940186359237064b428f (patch)
tree66d64a1518d79c3d0e90c0a1d0080cd88e887d99 /Objects/typeobject.c
parent67df285a3389c7fdb8c7bd301314ac45e17f8074 (diff)
downloadcpython-afe55bba33a20f87a58f940186359237064b428f.zip
cpython-afe55bba33a20f87a58f940186359237064b428f.tar.gz
cpython-afe55bba33a20f87a58f940186359237064b428f.tar.bz2
Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 2e6eb0a..f94dfbf 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2897,6 +2897,7 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject *sorted;
PyObject *sorted_methods = NULL;
PyObject *joined = NULL;
+ _Py_identifier(join);
/* Compute ", ".join(sorted(type.__abstractmethods__))
into joined. */
@@ -2919,7 +2920,7 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (comma == NULL)
goto error;
}
- joined = PyObject_CallMethod(comma, "join",
+ joined = _PyObject_CallMethodId(comma, &PyId_join,
"O", sorted_methods);
if (joined == NULL)
goto error;
@@ -3184,6 +3185,7 @@ slotnames(PyObject *cls)
PyObject *copyreg;
PyObject *slotnames;
static PyObject *str_slotnames;
+ _Py_identifier(_slotnames);
if (str_slotnames == NULL) {
str_slotnames = PyUnicode_InternFromString("__slotnames__");
@@ -3202,7 +3204,7 @@ slotnames(PyObject *cls)
if (copyreg == NULL)
return NULL;
- slotnames = PyObject_CallMethod(copyreg, "_slotnames", "O", cls);
+ slotnames = _PyObject_CallMethodId(copyreg, &PyId__slotnames, "O", cls);
Py_DECREF(copyreg);
if (slotnames != NULL &&
slotnames != Py_None &&
@@ -3323,7 +3325,8 @@ reduce_2(PyObject *obj)
Py_INCREF(dictitems);
}
else {
- PyObject *items = PyObject_CallMethod(obj, "items", "");
+ _Py_identifier(items);
+ PyObject *items = _PyObject_CallMethodId(obj, &PyId_items, "");
if (items == NULL)
goto end;
dictitems = PyObject_GetIter(items);