mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-17 05:49:37 +08:00
Compiled objects should also have a names_dict.
This commit is contained in:
+4
-5
@@ -149,16 +149,15 @@ def underscore_memoization(func):
|
||||
return wrapper
|
||||
|
||||
|
||||
def memoize(func):
|
||||
def memoize_method(method):
|
||||
"""A normal memoize function."""
|
||||
dct = {}
|
||||
|
||||
def wrapper(*args, **kwargs):
|
||||
def wrapper(self, *args, **kwargs):
|
||||
dct = self.__dict__.setdefault('_memoize_method_dct', {})
|
||||
key = (args, frozenset(kwargs.items()))
|
||||
try:
|
||||
return dct[key]
|
||||
except KeyError:
|
||||
result = func(*args, **kwargs)
|
||||
result = method(self, *args, **kwargs)
|
||||
dct[key] = result
|
||||
return result
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user