forked from VimPlug/jedi
Use the memoize function for faked arguments only when needed.
It's important to note that memoizing every object would mean that theoretically all objects passed through get_faked would get memoized. This would have been a possible memory leak, which we should avoid. Obviously the previous solution proposed in #649 was still better, but this issue was a new one. Also using str() around keys was not a good idea. Refs #649.
This commit is contained in:
@@ -91,18 +91,6 @@ def memoize_method(method):
|
||||
return wrapper
|
||||
|
||||
|
||||
def memoize_function(obj):
|
||||
""" A normal memoize function for memoizing free functions. """
|
||||
cache = obj.cache = {}
|
||||
|
||||
def memoizer(*args, **kwargs):
|
||||
key = str(args) + str(kwargs)
|
||||
if key not in cache:
|
||||
cache[key] = obj(*args, **kwargs)
|
||||
return cache[key]
|
||||
return memoizer
|
||||
|
||||
|
||||
def cache_star_import(func):
|
||||
@time_cache("star_import_cache_validity")
|
||||
def wrapper(self):
|
||||
|
||||
Reference in New Issue
Block a user