mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
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:
parent
c232c9110c
commit
46874c26ee
12 changed files with 24 additions and 34 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue