summaryrefslogtreecommitdiffstats
path: root/Objects/odictobject.c
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2020-01-30 23:20:25 (GMT)
committerGitHub <noreply@github.com>2020-01-30 23:20:25 (GMT)
commit46874c26ee1fc752e2e6930efa1d223b2351edb8 (patch)
treeb4c85470214ac73ec6e4fa9981bb1f0e7b46472e /Objects/odictobject.c
parentc232c9110cfefa0935cbf158e35e91746a8a9361 (diff)
downloadcpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.zip
cpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.gz
cpython-46874c26ee1fc752e2e6930efa1d223b2351edb8.tar.bz2
bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)
Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support.
Diffstat (limited to 'Objects/odictobject.c')
-rw-r--r--Objects/odictobject.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index dfbd30a..45e089b 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -526,6 +526,8 @@ struct _odictnode {
#define _odict_FOREACH(od, node) \
for (node = _odict_FIRST(od); node != NULL; node = _odictnode_NEXT(node))
+_Py_IDENTIFIER(items);
+
/* Return the index into the hash table, regardless of a valid node. */
static Py_ssize_t
_odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash)
@@ -896,7 +898,6 @@ static PyObject *
odict_reduce(register PyODictObject *od, PyObject *Py_UNUSED(ignored))
{
_Py_IDENTIFIER(__dict__);
- _Py_IDENTIFIER(items);
PyObject *dict = NULL, *result = NULL;
PyObject *items_iter, *items, *args = NULL;
@@ -1375,7 +1376,6 @@ static PyObject *
odict_repr(PyODictObject *self)
{
int i;
- _Py_IDENTIFIER(items);
PyObject *pieces = NULL, *result = NULL;
if (PyODict_SIZE(self) == 0)
@@ -2195,7 +2195,6 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
{
int res = 0;
Py_ssize_t len;
- _Py_IDENTIFIER(items);
_Py_IDENTIFIER(keys);
/* first handle args, if any */