This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Paul Pinterits
Recipients Paul Pinterits
Date 2018-08-28.19:37:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1535485064.24.0.56676864532.issue34536@psf.upfronthosting.co.za>
In-reply-to
Content
In a conversation with Ethan Furman (the author of the enum module) I've been informed that Enum automatically checks whether the _missing_ method has returned an instance of the correct class, and raises a TypeError if not. (Link: https://stackoverflow.com/a/52064774/1222951)

However, this simply does not happen.

```
import enum

class MyEnum(enum.Enum):
    FOO = "foo"

    @classmethod
    def _missing_(cls, value):
        return 5

print(MyEnum('bar'))  # output: 5
```
History
Date User Action Args
2018-08-28 19:37:44Paul Pinteritssetrecipients: + Paul Pinterits
2018-08-28 19:37:44Paul Pinteritssetmessageid: <1535485064.24.0.56676864532.issue34536@psf.upfronthosting.co.za>
2018-08-28 19:37:44Paul Pinteritslinkissue34536 messages
2018-08-28 19:37:44Paul Pinteritscreate