summaryrefslogtreecommitdiff
path: root/astroid/bases.py
diff options
context:
space:
mode:
authorBryce Guinta <bryce.paul.guinta@gmail.com>2018-07-08 21:39:59 -0600
committerBryce Guinta <bryce.guinta@protonmail.com>2018-07-13 18:15:50 -0600
commit2aa27e9aed6ffcba4a61655e291e852ecd001549 (patch)
treea72893897adc3a15015eca6837c37b51127f74d3 /astroid/bases.py
parentbe3ba810d57253942cdc9e0639a7ad0043f7a688 (diff)
downloadastroid-git-2aa27e9aed6ffcba4a61655e291e852ecd001549.tar.gz
Fix attributes of ancestor classes from appearing in attribute inference
Close #581
Diffstat (limited to 'astroid/bases.py')
-rw-r--r--astroid/bases.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/astroid/bases.py b/astroid/bases.py
index c7b0cbc3..caf230f1 100644
--- a/astroid/bases.py
+++ b/astroid/bases.py
@@ -343,9 +343,7 @@ class UnboundMethod(Proxy):
# instance of the class given as first argument.
if (self._proxied.name == '__new__' and
self._proxied.parent.frame().qname() == '%s.object' % BUILTINS):
- # XXX Avoid issue with type.__new__ inference.
- # https://github.com/PyCQA/astroid/issues/581
- if caller.args and len(caller.args) == 1:
+ if caller.args:
node_context = context.extra_context.get(caller.args[0])
infer = caller.args[0].infer(context=node_context)
else:
@@ -440,10 +438,7 @@ class BoundMethod(UnboundMethod):
if (self.bound.__class__.__name__ == 'ClassDef'
and self.bound.name == 'type'
and self.name == '__new__'
- and len(caller.args) == 4
- # TODO(cpopa): this check shouldn't be needed.
- and self._proxied.parent.frame().qname() == '%s.object' % BUILTINS):
-
+ and len(caller.args) == 4):
# Check if we have an ``type.__new__(mcs, name, bases, attrs)`` call.
new_cls = self._infer_type_new_call(caller, context)
if new_cls: