[issue46108] Enum repr() incorrect when mixed with dataclasses

Eric V. Smith report at bugs.python.org
Fri Dec 17 02:57:00 EST 2021


Eric V. Smith <eric at trueblade.com> added the comment:

I know you know this, but here's a version without dataclasses, in case you want to add a test for this, too.

from enum import Enum

class Foo:
    def __init__(self, a):
        self.a = a
    def __repr__(self):
        return f'Foo(a={self.a!r})'

class Entries(Foo, Enum):
    ENTRY1 = Foo(1)

repr(Entries.ENTRY1) != '<Entries.ENTRY1: Foo(a=1)>'

----------
nosy: +eric.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46108>
_______________________________________


More information about the Python-bugs-list mailing list