[Python-checkins] gh-93118: [Enum] fix error message (GH-93138) (GH-93142)

ethanfurman webhook-mailer at python.org
Mon May 23 17:37:38 EDT 2022


https://github.com/python/cpython/commit/b8c4cc6b76bde5371baee18c76146b86adb81dbb
commit: b8c4cc6b76bde5371baee18c76146b86adb81dbb
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ethanfurman <ethan at stoneleaf.us>
date: 2022-05-23T14:37:18-07:00
summary:

gh-93118: [Enum] fix error message (GH-93138) (GH-93142)

Include member names in error message.
(cherry picked from commit a49721ea075a18a7787ace6752b4eb0954e1b607)

files:
M Lib/enum.py

diff --git a/Lib/enum.py b/Lib/enum.py
index 43cd1bc2b1e31..31923d757f803 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -480,8 +480,9 @@ def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **k
         # check for illegal enum names (any others?)
         invalid_names = set(member_names) & {'mro', ''}
         if invalid_names:
-            raise ValueError('invalid enum member name(s) '.format(
-                ','.join(repr(n) for n in invalid_names)))
+            raise ValueError('invalid enum member name(s) %s'  % (
+                    ','.join(repr(n) for n in invalid_names)
+                    ))
         #
         # adjust the sunders
         _order_ = classdict.pop('_order_', None)



More information about the Python-checkins mailing list