diff options
| author | Bryce Guinta <bryce.paul.guinta@gmail.com> | 2018-07-04 03:48:26 -0600 |
|---|---|---|
| committer | Bryce Guinta <bryce.guinta@protonmail.com> | 2018-07-05 23:17:06 -0600 |
| commit | f5685db48bb7c74ed0de0269801781480f5ea9e5 (patch) | |
| tree | 4ce0ed52639779478c40d5d22f5eef35240b45c8 | |
| parent | e60971553a5b1aae53d85503b7797a2824ac8962 (diff) | |
| download | astroid-git-f5685db48bb7c74ed0de0269801781480f5ea9e5.tar.gz | |
Avoid calling object.__new__ for type.__new__
See #581
| -rw-r--r-- | astroid/bases.py | 4 |
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: |
