We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
testIterableUnpackingWithGetAttr
1 parent 895a821 commit 486a51bCopy full SHA for 486a51b
test-data/unit/check-classes.test
@@ -7810,6 +7810,12 @@ class D:
7810
return C()
7811
7812
def g(self) -> None:
7813
- # TODO: This is a false positive
+ # iter(x) looks up `__iter__` on the type of x rather than x itself,
7814
+ # so this is correct behaviour.
7815
+ # Instances of C should not be treated as being iterable,
7816
+ # despite having a __getattr__ method
7817
+ # that could allow for arbitrary attributes to be accessed on instances,
7818
+ # since `type(C()).__iter__` still raises AttributeError at runtime,
7819
+ # and that's what matters.
7820
a, b = self.f() # E: "C" has no attribute "__iter__" (not iterable)
7821
[builtins fixtures/tuple.pyi]
0 commit comments