summaryrefslogtreecommitdiff
path: root/astroid/decorators.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-08-26 20:51:18 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2015-08-26 20:51:18 +0300
commit80231203f7fed2db08a3132b3f4043365e01beb3 (patch)
tree9c70d9a31fe77c5d4ce400dd58c36b142a041a9d /astroid/decorators.py
parent3c368b4da27bbfa2fdcb6d88571ee5cc284560f1 (diff)
downloadastroid-80231203f7fed2db08a3132b3f4043365e01beb3.tar.gz
functools.wraps needs to be called with the decorated function and the implementation of cached decorator was passing the bad arguments
Diffstat (limited to 'astroid/decorators.py')
-rw-r--r--astroid/decorators.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/astroid/decorators.py b/astroid/decorators.py
index 2c6e40b..a446536 100644
--- a/astroid/decorators.py
+++ b/astroid/decorators.py
@@ -27,14 +27,13 @@ import wrapt
@wrapt.decorator
def cached(func, instance, args, kwargs):
"""Simple decorator to cache result of method calls without args."""
- wrapped_self, = args
- cache = getattr(wrapped_self, '__cache', None)
+ cache = getattr(instance, '__cache', None)
if cache is None:
- wrapped_self.__cache = cache = {}
+ instance.__cache = cache = {}
try:
return cache[func]
except KeyError:
- cache[func] = result = func(wrapped_self)
+ cache[func] = result = func(*args, **kwargs)
return result