summaryrefslogtreecommitdiffstats
path: root/Objects/iterobject.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/iterobject.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/iterobject.c')
-rw-r--r--Objects/iterobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index da89298..fe1de7e 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -11,6 +11,8 @@ typedef struct {
PyObject *it_seq; /* Set to NULL when iterator is exhausted */
} seqiterobject;
+_Py_IDENTIFIER(iter);
+
PyObject *
PySeqIter_New(PyObject *seq)
{
@@ -104,7 +106,6 @@ PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(
static PyObject *
iter_reduce(seqiterobject *it, PyObject *Py_UNUSED(ignored))
{
- _Py_IDENTIFIER(iter);
if (it->it_seq != NULL)
return Py_BuildValue("N(O)n", _PyEval_GetBuiltinId(&PyId_iter),
it->it_seq, it->it_index);
@@ -244,7 +245,6 @@ calliter_iternext(calliterobject *it)
static PyObject *
calliter_reduce(calliterobject *it, PyObject *Py_UNUSED(ignored))
{
- _Py_IDENTIFIER(iter);
if (it->it_callable != NULL && it->it_sentinel != NULL)
return Py_BuildValue("N(OO)", _PyEval_GetBuiltinId(&PyId_iter),
it->it_callable, it->it_sentinel);