summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2013-11-07 17:46:53 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2013-11-07 17:46:53 (GMT)
commite75fc148136bbef192c5572c14f3abf1f67abc57 (patch)
treefd2dc5da77e9fb8b242979d94a20242c3b6d5d80 /Objects
parentd0293596b85f362be990dcb4892ba7c544f51fb8 (diff)
downloadcpython-e75fc148136bbef192c5572c14f3abf1f67abc57.zip
cpython-e75fc148136bbef192c5572c14f3abf1f67abc57.tar.gz
cpython-e75fc148136bbef192c5572c14f3abf1f67abc57.tar.bz2
Issue #19514: Deduplicate some _Py_IDENTIFIER declarations.
Patch by Andrei Dorian Duma.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 299c611..8bccb68 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -39,16 +39,20 @@ struct method_cache_entry {
static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP];
static unsigned int next_version_tag = 0;
+/* alphabetical order */
+_Py_IDENTIFIER(__abstractmethods__);
_Py_IDENTIFIER(__class__);
+_Py_IDENTIFIER(__delitem__);
_Py_IDENTIFIER(__dict__);
_Py_IDENTIFIER(__doc__);
-_Py_IDENTIFIER(__getitem__);
_Py_IDENTIFIER(__getattribute__);
+_Py_IDENTIFIER(__getitem__);
_Py_IDENTIFIER(__hash__);
+_Py_IDENTIFIER(__len__);
_Py_IDENTIFIER(__module__);
_Py_IDENTIFIER(__name__);
_Py_IDENTIFIER(__new__);
-_Py_IDENTIFIER(__abstractmethods__);
+_Py_IDENTIFIER(__setitem__);
static PyObject *
slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
@@ -5068,7 +5072,6 @@ FUNCNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \
static Py_ssize_t
slot_sq_length(PyObject *self)
{
- _Py_IDENTIFIER(__len__);
PyObject *res = call_method(self, &PyId___len__, "()");
Py_ssize_t len;
@@ -5129,8 +5132,6 @@ static int
slot_sq_ass_item(PyObject *self, Py_ssize_t index, PyObject *value)
{
PyObject *res;
- _Py_IDENTIFIER(__delitem__);
- _Py_IDENTIFIER(__setitem__);
if (value == NULL)
res = call_method(self, &PyId___delitem__, "(n)", index);
@@ -5180,8 +5181,6 @@ static int
slot_mp_ass_subscript(PyObject *self, PyObject *key, PyObject *value)
{
PyObject *res;
- _Py_IDENTIFIER(__delitem__);
- _Py_IDENTIFIER(__setitem__);
if (value == NULL)
res = call_method(self, &PyId___delitem__, "(O)", key);
@@ -5232,7 +5231,6 @@ slot_nb_bool(PyObject *self)
PyObject *func, *args;
int result = -1;
int using_len = 0;
- _Py_IDENTIFIER(__len__);
_Py_IDENTIFIER(__bool__);
func = lookup_maybe(self, &PyId___bool__);