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
3 changes: 2 additions & 1 deletion mypyc/irbuild/classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,8 @@ def add_non_ext_class_attr(
# are final.
if (
cdef.info.bases
and cdef.info.bases[0].type.is_enum
# Enum class must be the last parent class.
and cdef.info.bases[-1].type.is_enum
# Skip these since Enum will remove it
and lvalue.name not in EXCLUDED_ENUM_ATTRIBUTES
):
Expand Down
13 changes: 13 additions & 0 deletions mypyc/test-data/run-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -2692,3 +2692,16 @@ print(native.C(22).v)

[out]
22.1

[case testLastParentEnum]
from enum import Enum

class ColorCode(str, Enum):
OKGREEN = "okgreen"

[file driver.py]
import native
print(native.ColorCode.OKGREEN.value)

[out]
okgreen
Loading