mercurial/util.py
changeset 20835 0e8417131a29
parent 20679 0916f829eb8d
child 21018 c848bfd02366
equal deleted inserted replaced
20834:8c210b169c69 20835:0e8417131a29
   186     )
   186     )
   187 
   187 
   188 def cachefunc(func):
   188 def cachefunc(func):
   189     '''cache the result of function calls'''
   189     '''cache the result of function calls'''
   190     # XXX doesn't handle keywords args
   190     # XXX doesn't handle keywords args
       
   191     if func.func_code.co_argcount == 0:
       
   192         cache = []
       
   193         def f():
       
   194             if len(cache) == 0:
       
   195                 cache.append(func())
       
   196             return cache[0]
       
   197         return f
   191     cache = {}
   198     cache = {}
   192     if func.func_code.co_argcount == 1:
   199     if func.func_code.co_argcount == 1:
   193         # we gain a small amount of time because
   200         # we gain a small amount of time because
   194         # we don't need to pack/unpack the list
   201         # we don't need to pack/unpack the list
   195         def f(arg):
   202         def f(arg):