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.
This commit is contained in:
Hai Shi 2020-01-30 17:20:25 -06:00 committed by GitHub
parent c232c9110c
commit 46874c26ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 34 deletions

View file

@ -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 */