Skip to content

Wrong line number for invalid iterable that uses __getattr__ #14892

@JukkaL

Description

@JukkaL

This generates an error false positive which is reported on the wrong line so there are likely two bugs:

from typing import Union, Tuple

class C:
    def __getattr__(self, name):
        pass

class D:
    def f(self) -> C: # "C" has no attribute "__iter__" (not iterable)
        return C()

    def g(self) -> None:
        a, b = self.f()  # This is where the error originates from

C should be treated as iterable, since it defines __getattr__.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions