Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/semanal_classprop.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def calculate_class_abstract_status(typ: TypeInfo, is_stub_file: bool, errors: E
# implement some methods.
typ.abstract_attributes = sorted(abstract)
if is_stub_file:
if typ.declared_metaclass and typ.declared_metaclass.type.fullname == "abc.ABCMeta":
if typ.declared_metaclass and typ.declared_metaclass.type.has_base("abc.ABCMeta"):
return
if typ.is_protocol:
return
Expand Down
13 changes: 13 additions & 0 deletions test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -5497,6 +5497,13 @@ class E(Protocol): # OK, is a protocol
class F(E, Protocol): # OK, is a protocol
pass

# Custom metaclass subclassing `ABCMeta`, see #13561
class CustomMeta(ABCMeta):
pass

class G(A, metaclass=CustomMeta): # Ok, has CustomMeta as a metaclass
pass

[file b.py]
# All of these are OK because this is not a stub file.
from abc import ABCMeta, abstractmethod
Expand Down Expand Up @@ -5525,6 +5532,12 @@ class E(Protocol):
class F(E, Protocol):
pass

class CustomMeta(ABCMeta):
pass

class G(A, metaclass=CustomMeta):
pass

[case testClassMethodOverride]
from typing import Callable, Any

Expand Down