github DetachHead/basedpyright v1.39.0
v1.39.0 (pyright 1.1.408)

5 hours ago

What's Changed

new diagnostic rule - reportEmptyAbstractUsage

pyright only reports an error when you instantiate an abstract class that has unimplemented abstract methods. but a class that explicitly extends ABC (or uses ABCMeta) with no abstract methods can also be instantiated, and pyright has no issue with that:

from abc import ABC


class Foo(ABC):
    """abstract class with no abstract methods"""


foo = Foo()  # no error

but the author of the class likely intended this class not to be used directly, and instead subtyped. so if a class extends ABC but defines no abstract methods, instantiating it is likely unintentional.

the reportEmptyAbstractUsage rule flags such instantiations. see the docs for more info.

implemented by @KotlinIsland in #1748 (some fixes by @DetachHead in #1766)

Full Changelog: v1.38.4...v1.39.0

Don't miss a new basedpyright release

NewReleases is sending notifications on new releases.