Skip to content

[Enum] Exception being ignored in custom datatypes #102549

Closed
@ethanfurman

Description

@ethanfurman
import enum

class Base:
    def __init__(self, x):
        print('In Base init')
        raise ValueError("I don't like", x)

class MyEnum(Base, enum.Enum):
    A = 'a'
    def __init__(self, y):
        print('In MyEnum init')
        self.y = y

MyEnum should not be created because of the exception in Base.__init__.

Linked PRs

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions