From: Raymond Hettinger Date: Fri, 3 Apr 2009 02:47:57 +0000 (+0000) Subject: Localize the function lookup in timeit. X-Git-Tag: v2.6.2c1~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d7b009e9913f835a1a91281ffe4114736008bc95;p=thirdparty%2FPython%2Fcpython.git Localize the function lookup in timeit. --- diff --git a/Lib/timeit.py b/Lib/timeit.py index c0b085611465..9054243a9bc0 100644 --- a/Lib/timeit.py +++ b/Lib/timeit.py @@ -92,11 +92,11 @@ def reindent(src, indent): def _template_func(setup, func): """Create a timer function. Used if the "statement" is a callable.""" - def inner(_it, _timer): + def inner(_it, _timer, _func=func): setup() _t0 = _timer() for _i in _it: - func() + _func() _t1 = _timer() return _t1 - _t0 return inner