summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-11 06:28:18 (GMT)
committerGitHub <noreply@github.com>2018-12-11 06:28:18 (GMT)
commitbb86bf4c4eaa30b1f5192dab9f389ce0bb61114d (patch)
treeb9dbe54e2c1380294f3e2396450132d5b205af0a /Objects/setobject.c
parent7cf3d8e25174c8871883e42f3240fd7f01efd3a8 (diff)
downloadcpython-bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d.zip
cpython-bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d.tar.gz
cpython-bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d.tar.bz2
bpo-35444: Unify and optimize the helper for getting a builtin object. (GH-11047)
This speeds up pickling of some iterators. This fixes also error handling in pickling methods when fail to look up builtin "getattr".
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index c2a1467..a43ecd5 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -842,6 +842,7 @@ static PyObject *setiter_iternext(setiterobject *si);
static PyObject *
setiter_reduce(setiterobject *si, PyObject *Py_UNUSED(ignored))
{
+ _Py_IDENTIFIER(iter);
/* copy the iterator state */
setiterobject tmp = *si;
Py_XINCREF(tmp.si_set);
@@ -852,7 +853,7 @@ setiter_reduce(setiterobject *si, PyObject *Py_UNUSED(ignored))
if (list == NULL) {
return NULL;
}
- return Py_BuildValue("N(N)", _PyObject_GetBuiltin("iter"), list);
+ return Py_BuildValue("N(N)", _PyEval_GetBuiltinId(&PyId_iter), list);
}
PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");