From: Raymond Hettinger Date: Sat, 14 Aug 2010 22:29:52 +0000 (+0000) Subject: Localize one more builtin lookup. X-Git-Tag: v3.2a2~312 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5202fadb2c3ceaa00fbdb8078ca462b9af0b0ea9;p=thirdparty%2FPython%2Fcpython.git Localize one more builtin lookup. --- diff --git a/Lib/functools.py b/Lib/functools.py index 815386b8ab9a..f6ae4f4a6436 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -119,7 +119,8 @@ def lfu_cache(maxsize=100): http://en.wikipedia.org/wiki/Cache_algorithms#Least-Frequently_Used """ - def decorating_function(user_function, tuple=tuple, sorted=sorted, len=len): + def decorating_function(user_function, tuple=tuple, sorted=sorted, + len=len, KeyError=KeyError): cache = {} # mapping of args to results use_count = Counter() # times each key has been accessed kwd_mark = object() # separate positional and keyword args @@ -170,7 +171,8 @@ def lru_cache(maxsize=100): http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used """ - def decorating_function(user_function, tuple=tuple, sorted=sorted, len=len): + def decorating_function(user_function, tuple=tuple, sorted=sorted, + len=len, KeyError=KeyError): cache = OrderedDict() # ordered least recent to most recent kwd_mark = object() # separate positional and keyword args lock = Lock()