summaryrefslogtreecommitdiffstats
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2023-03-23 20:30:18 (GMT)
committerGitHub <noreply@github.com>2023-03-23 20:30:18 (GMT)
commitbd063756b34003c1bc7cacf5b1bd90a409180fb6 (patch)
tree886c4614e9bda5fc6e360f22ca245b0b5875a32e /Lib/enum.py
parent16f6165b71e81b5e4d0be660ac64a9fce7dfd86c (diff)
downloadcpython-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.py2
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_))