Submitter | Katsunori FUJIWARA |
---|---|
Date | Jan. 18, 2014, 3:23 p.m. |
Message ID | <3a11772a30d072c0de25.1390058639@vm-debian.dzone.foozy.private> |
Download | mbox | patch |
Permalink | /patch/3381/ |
State | Superseded |
Headers | show |
Comments
Patch
diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -188,6 +188,13 @@ def cachefunc(func): '''cache the result of function calls''' # XXX doesn't handle keywords args + if func.func_code.co_argcount == 0: + cache = [] + def f(): + if len(cache) == 0: + cache.append(func()) + return cache[0] + return f cache = {} if func.func_code.co_argcount == 1: # we gain a small amount of time because