Merge pull request #42708 from cro/dont_change_args_during_memoize

Do not change the arguments of the function when memoizing
This commit is contained in:
Nicole Thomas 2017-08-08 09:47:01 -04:00 committed by GitHub
commit dcf474c47c

View file

@ -251,9 +251,8 @@ def memoize(func):
str_args.append(str(arg))
else:
str_args.append(arg)
args = str_args
args_ = ','.join(list(args) + ['{0}={1}'.format(k, kwargs[k]) for k in sorted(kwargs)])
args_ = ','.join(list(str_args) + ['{0}={1}'.format(k, kwargs[k]) for k in sorted(kwargs)])
if args_ not in cache:
cache[args_] = func(*args, **kwargs)
return cache[args_]