Skip to content

Commit

Permalink
Fix misleading TODO comment in testIterableUnpackingWithGetAttr (#1…
Browse files Browse the repository at this point in the history
…4894)

Follow-up to #14893

See #14892 for more discussion
  • Loading branch information
AlexWaygood authored Mar 13, 2023
1 parent 895a821 commit 486a51b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -7810,6 +7810,12 @@ class D:
return C()

def g(self) -> None:
# TODO: This is a false positive
# iter(x) looks up `__iter__` on the type of x rather than x itself,
# so this is correct behaviour.
# Instances of C should not be treated as being iterable,
# despite having a __getattr__ method
# that could allow for arbitrary attributes to be accessed on instances,
# since `type(C()).__iter__` still raises AttributeError at runtime,
# and that's what matters.
a, b = self.f() # E: "C" has no attribute "__iter__" (not iterable)
[builtins fixtures/tuple.pyi]

0 comments on commit 486a51b

Please sign in to comment.