classification
Title: EnumMeta.__new__ should use enum_class.__new__
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Enum: mixin classes don't mix well with already mixed Enums
View: 29577
Assigned To: ethan.furman Nosy List: barry, eli.bendersky, ethan.furman, rs2
Priority: normal Keywords:

Created on 2018-07-10 09:43 by rs2, last changed 2018-09-11 01:21 by ethan.furman. This issue is now closed.

Messages (2)
msg321370 - (view) Author: Pav (rs2) Date: 2018-07-10 09:43
```python
class Foo:
    pass

class Works(str, Foo, Enum):
    BAR = 'baz'

class Fails(Foo, str, Enum):
    BAR = 'baz'

```

`Fails` fails to be created with an error:

`TypeError: object.__new__(Fails) is not safe, use Fails.__new__()`

See https://github.com/python/cpython/blob/e57f91a0f0d5700ec466c9dd0fd2d2b5323a5e76/Lib/enum.py#L205
msg324974 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2018-09-11 01:21
The solution to 29577 will also fix this.
History
Date User Action Args
2018-09-11 01:21:40ethan.furmansetstatus: open -> closed
superseder: Enum: mixin classes don't mix well with already mixed Enums
messages: + msg324974

resolution: duplicate
stage: resolved
2018-07-10 14:09:33ethan.furmansetassignee: ethan.furman

nosy: + barry, eli.bendersky, ethan.furman
2018-07-10 09:43:46rs2create