mirror of
https://github.com/astral-sh/ruff
synced 2026-01-11 08:34:29 -05:00
## Summary Typeshed has a (fake) `__getattr__` method on `types.ModuleType` with a return type of `Any`. We ignore this method when accessing attributes on module *literals*, but with this PR, we respect this method when dealing with `ModuleType` itself. That is, we allow arbitrary attribute accesses on instances of `types.ModuleType`. This is useful because dynamic import mechanisms such as `importlib.import_module` use `ModuleType` as a return type. closes https://github.com/astral-sh/ty/issues/1346 ## Ecosystem Massive reduction in diagnostics. The few new diagnostics are true positives. ## Test Plan Added regression test.
Markdown files within the mdtest/ subdirectory are tests of type inference and type checking;
executed by the tests/mdtest.rs integration test.
See crates/ty_test/README.md for documentation of this test format.