mirror of
https://github.com/python/cpython.git
synced 2025-08-28 04:35:02 +00:00
gh-102558: [Enum] fix AttributeError during member repr() (GH-102601)
This commit is contained in:
parent
16f6165b71
commit
bd063756b3
2 changed files with 10 additions and 1 deletions
|
@ -1186,6 +1186,8 @@ class Enum(metaclass=EnumType):
|
|||
return None
|
||||
|
||||
def __repr__(self):
|
||||
if not isinstance(self, Enum):
|
||||
return repr(self)
|
||||
v_repr = self.__class__._value_repr_ or repr
|
||||
return "<%s.%s: %s>" % (self.__class__.__name__, self._name_, v_repr(self._value_))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue