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 Python docs warn about such usage, but I am not aware of any linter that currently catches the error:
Adding dataclass() decorator to Enum and its subclasses is not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other
Note: The docs mention that dataclass mixins can be used with enums, so there are some valid combinations of the constructs.
Motivation
There was a bug in archinstall because a
dataclass
decorator was incorrectly applied to anEnum
:The Python docs warn about such usage, but I am not aware of any linter that currently catches the error:
Note: The docs mention that dataclass mixins can be used with enums, so there are some valid combinations of the constructs.
Related discussions
@dataclass
should not be applied on enums python/cpython#114891Documentation
Real world bugs
The text was updated successfully, but these errors were encountered: