diff options
-rw-r--r-- | astroid/bases.py | 2 | ||||
-rw-r--r-- | astroid/tests/unittest_inference.py | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/astroid/bases.py b/astroid/bases.py index 277ad316..c7b0cbc3 100644 --- a/astroid/bases.py +++ b/astroid/bases.py @@ -345,7 +345,7 @@ class UnboundMethod(Proxy): 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) != 4: + if caller.args and len(caller.args) == 1: node_context = context.extra_context.get(caller.args[0]) infer = caller.args[0].infer(context=node_context) else: diff --git a/astroid/tests/unittest_inference.py b/astroid/tests/unittest_inference.py index e31d19a9..353ac23b 100644 --- a/astroid/tests/unittest_inference.py +++ b/astroid/tests/unittest_inference.py @@ -3306,13 +3306,11 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase): self.assertEqual(attributes[0].value, 1) - @pytest.mark.xfail(reason="These calls should be uninferable because they are invalid calls") def test_type__new__not_enough_arguments(self): ast_nodes = extract_node(''' - type.__new__(1) #@ - type.__new__(1, 2) #@ - type.__new__(1, 2, 3) #@ - type.__new__(1, 2, 3, 4, 5) #@ + type.__new__(type, 'foo') #@ + type.__new__(type, 'foo', ()) #@ + type.__new__(type, 'foo', (), {}, ()) #@ ''') for node in ast_nodes: with pytest.raises(InferenceError): |