There is a surprising hole in Python's checkers: Ruff, Mypy, Pylint, and Pyflakes.
The test file
Consider the following file:
class Test:
__slots__ = ('good',)
def main():
t = Test()
print(t.bad)
main()
When executing this file, Python throws an AttributeError as expected: the instance t of the Test class has no "bad" attribute. But none of the checkers listed above detect this error!
Iirc Pylint used to discover at least some of these errors, but it no longer does.
Summary
I have filed Ruff issue #10833 on this topic. All the checkers fail with or without the __slots__ statement.
Leo issue #3852 suggests creating a tool to find such errors.
Edward
There is a surprising hole in Python's checkers: Ruff, Mypy, Pylint, and Pyflakes.