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 puddly
Recipients barry, eli.bendersky, ethan.furman, puddly
Date 2020-09-30.04:21:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601439696.58.0.28102514399.issue41889@roundup.psfhosted.org>
In-reply-to
Content
The following code worked in 3.8.5 but does not in 3.8.6 due to the fix for #39587:

```
import enum


class MyInt(int):
    def __new__(cls, value):
        return super().__new__(cls, value)

class HexMixin:
    def __repr__(self):
        return hex(self)

class MyIntEnum(HexMixin, MyInt, enum.Enum):
    pass


class Foo(MyIntEnum):
    TEST = 1

assert isinstance(Foo.TEST, MyInt)
assert repr(Foo.TEST) == "0x1"
```


In 3.8.6, the `Foo` enum itself fails to be created because `HexMixin` is now considered the member type instead of `MyInt`:

```
Traceback (most recent call last):
  File "enum_test.py", line 18, in <module>
    class Foo(MyIntEnum):
  File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/enum.py", line 215, in __new__
    enum_member = __new__(enum_class)
TypeError: object.__new__(Foo) is not safe, use int.__new__()
```
History
Date User Action Args
2020-09-30 04:21:36puddlysetrecipients: + puddly, barry, eli.bendersky, ethan.furman
2020-09-30 04:21:36puddlysetmessageid: <1601439696.58.0.28102514399.issue41889@roundup.psfhosted.org>
2020-09-30 04:21:36puddlylinkissue41889 messages
2020-09-30 04:21:35puddlycreate