mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #41014 from cachedout/issue_40937
Ensure strings in decorator
This commit is contained in:
commit
eb0e40a867
@ -245,6 +245,14 @@ def memoize(func):
|
||||
|
||||
@wraps(func)
|
||||
def _memoize(*args, **kwargs):
|
||||
str_args = []
|
||||
for arg in args:
|
||||
if not isinstance(arg, six.string_types):
|
||||
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)])
|
||||
if args_ not in cache:
|
||||
cache[args_] = func(*args, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user