Mercurial > hg-stable
changeset 28832:f5ff10f6fa6b
util: use __code__ (available since py2.6)
author | timeless <timeless@mozdev.org> |
---|---|
date | Tue, 29 Mar 2016 17:43:23 +0000 |
parents | 6b86ce3e3576 |
children | 672fc23bf9cc |
files | mercurial/util.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Sun Apr 03 11:20:50 2016 +0900 +++ b/mercurial/util.py Tue Mar 29 17:43:23 2016 +0000 @@ -450,7 +450,7 @@ def cachefunc(func): '''cache the result of function calls''' # XXX doesn't handle keywords args - if func.func_code.co_argcount == 0: + if func.__code__.co_argcount == 0: cache = [] def f(): if len(cache) == 0: @@ -458,7 +458,7 @@ return cache[0] return f cache = {} - if func.func_code.co_argcount == 1: + if func.__code__.co_argcount == 1: # we gain a small amount of time because # we don't need to pack/unpack the list def f(arg): @@ -700,7 +700,7 @@ '''cache most recent results of function calls''' cache = {} order = collections.deque() - if func.func_code.co_argcount == 1: + if func.__code__.co_argcount == 1: def f(arg): if arg not in cache: if len(cache) > 20: