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 
<https://github.com/astral-sh/ruff/issues/10833> on this topic. All the 
checkers fail with or without the __slots__ statement.


Leo issue #3852 <https://github.com/leo-editor/leo-editor/issues/3852> 
suggests creating a tool to find such errors.


Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/a2bcdf3a-9962-447a-a312-a0554d5d48afn%40googlegroups.com.

Reply via email to