Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misleading TODO comment in testIterableUnpackingWithGetAttr #14894

Merged
merged 3 commits into from
Mar 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 shoud not be treated iterable,
AlexWaygood marked this conversation as resolved.
Show resolved Hide resolved
# 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]