]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-93118: [Enum] fix error message (GH-93138) (GH-93142)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 23 May 2022 21:37:18 +0000 (14:37 -0700)
committerGitHub <noreply@github.com>
Mon, 23 May 2022 21:37:18 +0000 (14:37 -0700)
Include member names in error message.
(cherry picked from commit a49721ea075a18a7787ace6752b4eb0954e1b607)

Lib/enum.py

index 43cd1bc2b1e313f17c61bc4b34b883ff1bfb09ed..31923d757f803ef8ea16baa5b454c92d5c792e66 100644 (file)
@@ -480,8 +480,9 @@ class EnumType(type):
         # 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)