Closed
Description
Bug report
Bug description:
Hello,
when Enum with @DataClass decorator is used in a match statement, the results seem to be wrong. Consider this example:
from enum import Enum, auto
from dataclasses import dataclass
@dataclass
class Color(str, Enum):
Red = auto()
Green = auto()
mode = Color.Green
match mode:
case Color.Red:
print(f"Matched RED, actual {mode}")
case Color.Green:
print(f"Matched GREEN, actual {mode}")
case _:
assert False
I think it should print:
Matched GREEN, actual Color.Green
but it prints:
Matched RED, actual Color.Green
I would suggest this either prints the expected result, or at least produces some error instead of the current behaviour.
CPython versions tested on:
3.11
Operating systems tested on:
Linux