mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
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".
This commit is contained in:
parent
7cf3d8e251
commit
bb86bf4c4e
21 changed files with 68 additions and 72 deletions
|
|
@ -368,8 +368,9 @@ _grouper_next(_grouperobject *igo)
|
|||
static PyObject *
|
||||
_grouper_reduce(_grouperobject *lz, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
_Py_IDENTIFIER(iter);
|
||||
if (((groupbyobject *)lz->parent)->currgrouper != lz) {
|
||||
return Py_BuildValue("N(())", _PyObject_GetBuiltin("iter"));
|
||||
return Py_BuildValue("N(())", _PyEval_GetBuiltinId(&PyId_iter));
|
||||
}
|
||||
return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->parent, lz->tgtkey);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue