diff options
author | Dong-hee Na <donghee.na@python.org> | 2023-03-23 20:30:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 20:30:18 (GMT) |
commit | bd063756b34003c1bc7cacf5b1bd90a409180fb6 (patch) | |
tree | 886c4614e9bda5fc6e360f22ca245b0b5875a32e /Lib/enum.py | |
parent | 16f6165b71e81b5e4d0be660ac64a9fce7dfd86c (diff) | |
download | cpython-bd063756b34003c1bc7cacf5b1bd90a409180fb6.zip cpython-bd063756b34003c1bc7cacf5b1bd90a409180fb6.tar.gz cpython-bd063756b34003c1bc7cacf5b1bd90a409180fb6.tar.bz2 |
gh-102558: [Enum] fix AttributeError during member repr() (GH-102601)
Diffstat (limited to 'Lib/enum.py')
-rw-r--r-- | Lib/enum.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index d14e91a..ba92766 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -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_)) |