changeset 20835 | 0e8417131a29 |
parent 20679 | 0916f829eb8d |
child 21018 | c848bfd02366 |
--- a/mercurial/util.py Wed Mar 26 12:52:57 2014 -0500 +++ b/mercurial/util.py Sat Feb 15 19:52:26 2014 +0900 @@ -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