summaryrefslogtreecommitdiffstats
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-03-23 20:56:38 (GMT)
committerGitHub <noreply@github.com>2023-03-23 20:56:38 (GMT)
commit8132aefa0f23cb65b004e6f7b203f9f7b47fd997 (patch)
tree285607d7f93e0f441bfa7695879355991e2dd2d1 /Lib/enum.py
parent60b2b58f87af178f8eb5e4b579f8a518c267373f (diff)
downloadcpython-8132aefa0f23cb65b004e6f7b203f9f7b47fd997.zip
cpython-8132aefa0f23cb65b004e6f7b203f9f7b47fd997.tar.gz
cpython-8132aefa0f23cb65b004e6f7b203f9f7b47fd997.tar.bz2
gh-102558: [Enum] fix AttributeError during member repr() (GH-102601)
(cherry picked from commit bd063756b34003c1bc7cacf5b1bd90a409180fb6) Co-authored-by: Dong-hee Na <donghee.na@python.org>
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 5cff417..ea55f7b 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -1187,6 +1187,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_))