diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-11 06:28:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-11 06:28:18 (GMT) |
commit | bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d (patch) | |
tree | b9dbe54e2c1380294f3e2396450132d5b205af0a /Objects/dictobject.c | |
parent | 7cf3d8e25174c8871883e42f3240fd7f01efd3a8 (diff) | |
download | cpython-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/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 72cb4c5..a871636 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -3810,6 +3810,7 @@ dict___reversed___impl(PyDictObject *self) static PyObject * dictiter_reduce(dictiterobject *di, PyObject *Py_UNUSED(ignored)) { + _Py_IDENTIFIER(iter); /* copy the iterator state */ dictiterobject tmp = *di; Py_XINCREF(tmp.di_dict); @@ -3819,7 +3820,7 @@ dictiter_reduce(dictiterobject *di, 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); } PyTypeObject PyDictRevIterItem_Type = { |