DetachHead / basedpyright

pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server
https://docs.basedpyright.com
Other
935 stars 17 forks source link

no error when instantiating class that uses `abstractmethod` but doesn't extend `ABC` #609

Open DetachHead opened 3 weeks ago

DetachHead commented 3 weeks ago

Code sample in basedpyright playground

from abc import abstractmethod

class Foo:
    @abstractmethod
    def foo():...

_ = Foo()

this was rejected upstream due to performance reasons: https://github.com/microsoft/pyright/issues/5026, so instead we could probably just report an error on usages of abstractmethod if the class does not extend ABC. this would need to be a new diagnostic rule for backwards compatibility reasons

DetachHead commented 3 weeks ago

probably also need to consider #294