diff options
Diffstat (limited to 'chromium/tools/json_schema_compiler/memoize.py')
-rw-r--r-- | chromium/tools/json_schema_compiler/memoize.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/chromium/tools/json_schema_compiler/memoize.py b/chromium/tools/json_schema_compiler/memoize.py index 1402a6ecd80..228e7e3f82d 100644 --- a/chromium/tools/json_schema_compiler/memoize.py +++ b/chromium/tools/json_schema_compiler/memoize.py @@ -6,8 +6,9 @@ def memoize(fn): '''Decorates |fn| to memoize. ''' memory = {} - def impl(*args): - if args not in memory: - memory[args] = fn(*args) - return memory[args] + def impl(*args, **optargs): + full_args = args + tuple(optargs.iteritems()) + if full_args not in memory: + memory[full_args] = fn(*args, **optargs) + return memory[full_args] return impl |