-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Bug Report
Inheriting an Enum
-class and overriding, for example, a dunder-attribute fails to typecheck. Although it works fine during runtime.
To Reproduce
from enum import Enum
class BaseEnum(Enum):
__something__ = 3
class SomeEnum(BaseEnum):
__something__ = 2
Expected Behavior
It should typecheck, as it passes during runtime.
Actual Behavior
error: Cannot override final attribute "__something__" (previously declared in base class "BaseEnum")
Your Environment
- Mypy version used:
master
(26fdd45) - Mypy command-line flags: -
- Mypy configuration options from
mypy.ini
(and other config files):
strict_optional = True
- Python version used:
3.9.4
- Operating system and version: MacOS Catalina
10.15.6
The issue has also been briefly mentioned in these places:
RJPercival, harshil21 and hamdanal