cpython: c35d65c9ded3 (original) (raw)

Mercurial > cpython

changeset 99223:c35d65c9ded3

Issue #25557: Refactor _PyDict_LoadGlobal() Don't fallback to PyDict_GetItemWithError() if the hash is unknown: compute the hash instead. Add also comments to explain the optimization a little bit. [#25557]

Victor Stinner victor.stinner@gmail.com
date Fri, 20 Nov 2015 09:24:02 +0100
parents 2d90f4b27743
children 14a3cfc477c6
files Objects/dictobject.c Python/ceval.c
diffstat 2 files changed, 38 insertions(+), 28 deletions(-)[+] [-] Objects/dictobject.c 55 Python/ceval.c 11

line wrap: on

line diff

--- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1165,39 +1165,42 @@ PyObject return PyDict_GetItemWithError(dp, kv); } -/ Fast version of global value lookup. +/* Fast version of global value lookup (LOAD_GLOBAL).

+

+

+

} /* CAUTION: PyDict_SetItem() must guarantee that it won't resize the

--- a/Python/ceval.c +++ b/Python/ceval.c @@ -2347,26 +2347,33 @@ PyEval_EvalFrameEx(PyFrameObject *f, int PyObject *name = GETITEM(names, oparg); PyObject *v; if (PyDict_CheckExact(f->f_globals)

+