You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The mypy check over a loop with three or more classes that have abstract methods fails.
Apologies in advance for the terrible title but I couldn't find a good short way to express the issue here.
To Reproduce
The following fails:
fromabcimportABC, abstractmethodclassBase(ABC):
@staticmethod@abstractmethoddefdetect() ->bool:
passclassA(Base):
@staticmethoddefdetect() ->bool:
returnTrueclassAA(Base):
@staticmethoddefdetect() ->bool:
returnTrueclassAAA(Base):
@staticmethoddefdetect() ->bool:
returnTrue# With three of them mypy FAILS.# ------------------------------forclsin (AAA, AA, A):
ifcls.detect():
cls()
The error:
error: Cannot instantiate abstract class "Base" with abstract attribute "detect" [abstract]
However, this ONLY appears with three of these subclasses in a tuple. Any combination of classes that have three or less passes the mypy test:
# Any of the below combinations of iterables work howeverforclsin (AA, A):
ifcls.detect():
cls()
forclsin (AAA, AA):
ifcls.detect():
cls()
forclsin (AAA, A):
ifcls.detect():
cls()
Expected Behavior
There should either be consistently no error or an error in all cases regardless of over how many classes we iterate.
Your Environment
Mypy version used: mypy 0.961 (compiled: yes)
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Python version used: 3.10
Operating system and version: MacOS
The text was updated successfully, but these errors were encountered:
Bug Report
The mypy check over a loop with three or more classes that have abstract methods fails.
Apologies in advance for the terrible title but I couldn't find a good short way to express the issue here.
To Reproduce
The following fails:
The error:
However, this ONLY appears with three of these subclasses in a tuple. Any combination of classes that have three or less passes the mypy test:
Expected Behavior
There should either be consistently no error or an error in all cases regardless of over how many classes we iterate.
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: