forked from VimPlug/jedi
Fix the fundamentally wrong cache.
This commit is contained in:
@@ -80,13 +80,13 @@ def time_cache(time_add_setting):
|
||||
def memoize_method(method):
|
||||
"""A normal memoize function."""
|
||||
def wrapper(self, *args, **kwargs):
|
||||
dct = self.__dict__.setdefault('_memoize_method_dct', {})
|
||||
cache_dict = self.__dict__.setdefault('_memoize_method_dct', {})
|
||||
dct = cache_dict.setdefault(method, {})
|
||||
key = (args, frozenset(kwargs.items()))
|
||||
try:
|
||||
return dct[key]
|
||||
except KeyError:
|
||||
result = method(self, *args, **kwargs)
|
||||
# TODO THIS IS FUNDAMENTALLY WRONG, METHOD SHOULD BE INCLUDED.
|
||||
dct[key] = result
|
||||
return result
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user