summaryrefslogtreecommitdiff
path: root/inference.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-04-13 11:50:59 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2014-04-13 11:50:59 +0300
commit4e92fa523f75143070ccb704e62d82fb4fcba23c (patch)
treef902c0a932540742eda48b7fbf75b8bdc945b139 /inference.py
parent9781343aa75f6425b4ea68ea9eb149770160dfba (diff)
downloadastroid-git-4e92fa523f75143070ccb704e62d82fb4fcba23c.tar.gz
Fix argument search for methods and classmethods.
--HG-- branch : args_fix
Diffstat (limited to 'inference.py')
-rw-r--r--inference.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/inference.py b/inference.py
index 29c97be5..35cce332 100644
--- a/inference.py
+++ b/inference.py
@@ -72,6 +72,11 @@ class CallContext:
return iter((boundnode,))
if funcnode.type == 'classmethod':
return iter((boundnode,))
+ # if we have a method, extract one position
+ # from the index, so we'll take in account
+ # the extra parameter represented by `self` or `cls`
+ if funcnode.type in ('method', 'classmethod'):
+ argindex -= 1
# 2. search arg index
try:
return self.args[argindex].infer(context)