From: Petr Viktorin Date: Fri, 16 Jan 2015 14:24:03 +0000 (+0100) Subject: buildtools: Use separate storage for each function in runonce X-Git-Tag: tevent-0.9.23~109 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=a0cbce60f4dac2ef1086758299a48f2390e2e2ea buildtools: Use separate storage for each function in runonce The runonce decorator used shared storage for all functions, and dispatched only on arguments, so a call would be eliminated if a different runonce function had already been called with the same arguments. Use separate storage for each decorated function. Signed-off-by: Petr Viktorin Reviewed-by: Simo Sorce Reviewed-by: Andreas Schneider --- diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py index 9ac10666f39..df4a552dbee 100644 --- a/buildtools/wafsamba/samba_utils.py +++ b/buildtools/wafsamba/samba_utils.py @@ -39,8 +39,8 @@ def GET_TARGET_TYPE(ctx, target): # this is used as a decorator to make functions only # run once. Based on the idea from # http://stackoverflow.com/questions/815110/is-there-a-decorator-to-simply-cache-function-return-values -runonce_ret = {} def runonce(function): + runonce_ret = {} def runonce_wrapper(*args): if args in runonce_ret: return runonce_ret[args]