Skip to content

Join of two type concrete type objects may be considered abstract #3115

@JukkaL

Description

@JukkaL

Mypy complains about the following code even though it looks fine:

from abc import abstractmethod

class Base:
    @abstractmethod
    def f(self) -> None: pass
class A(Base):
    def f(self) -> None: pass
class B(Base):
    def f(self) -> None: pass

t = [A, B]

t[0]()  # Cannot instantiate abstract class 'Base' with abstract attribute 'f'

It looks like the join of two callables representing type objects should perhaps be Type[x] instead of another callable, since mypy basically assumes that a callable represents a specific type object, not something that can also be any subclass. The same issue probably applies to meets as well.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions