ruff
0e8636cc - [ty] Diagnose invalid module-level __getattr__ calls (#27507)

Commit
11 hours ago
[ty] Diagnose invalid module-level __getattr__ calls (#27507) ## Summary Previously, an invalid module-level `__getattr__` function caused us to report that the requested attribute was missing, even though Python actually invokes the function and raises `TypeError`: ```python # example.py def __getattr__() -> str: return "fallback" # main.py import example example.missing # error: [invalid-attribute-access] from example import missing # error: [invalid-module-getattr-call] ``` We now propagate failed module-level `__getattr__` calls through member lookup, preserve the function's return type for error recovery, and point diagnostics at its definition. Direct attribute access uses `invalid-attribute-access`, while failed `from` imports use the dedicated `invalid-module-getattr-call` rule. Defined module attributes and real submodules continue to take precedence.
Author
Parents
Loading