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
941 stars 17 forks source link

false positive `reportUnsafeMultipleInheritance` when `__init__` call's `super` #623

Open KotlinIsland opened 2 weeks ago

KotlinIsland commented 2 weeks ago
class A:
    def __init__(self):
        super().__init__()

class B:
    def __init__(self):
        pass

class Something(A, B):  # error: Multiple inheritance is not allowed because the following base classes contain `__init__` or `__new__` methods that may not get called: B
    ...

playground

DetachHead commented 2 weeks ago

i originally didn't want to rely on checking constructor's implementation because it won't always be available eg. in stub files. but i guess there's no reason not to check it if it is available

DetachHead commented 2 weeks ago

it would also need to ensure that the super().__init__ call matches the signature of the other class's constructor