summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Guinta <bryce.paul.guinta@gmail.com>2018-07-04 03:48:26 -0600
committerBryce Guinta <bryce.guinta@protonmail.com>2018-07-05 23:17:06 -0600
commitf5685db48bb7c74ed0de0269801781480f5ea9e5 (patch)
tree4ce0ed52639779478c40d5d22f5eef35240b45c8
parente60971553a5b1aae53d85503b7797a2824ac8962 (diff)
downloadastroid-git-f5685db48bb7c74ed0de0269801781480f5ea9e5.tar.gz
Avoid calling object.__new__ for type.__new__
See #581
-rw-r--r--astroid/bases.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/astroid/bases.py b/astroid/bases.py
index fa9ca00a..277ad316 100644
--- a/astroid/bases.py
+++ b/astroid/bases.py
@@ -343,7 +343,9 @@ 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):
- if caller.args:
+ # XXX Avoid issue with type.__new__ inference.
+ # https://github.com/PyCQA/astroid/issues/581
+ if caller.args and len(caller.args) != 4:
node_context = context.extra_context.get(caller.args[0])
infer = caller.args[0].infer(context=node_context)
else: