From 324a9f0799f36c622130fdc6e45c69fd8526ccfc Mon Sep 17 00:00:00 2001 From: Ethan Furman Date: Mon, 23 May 2022 11:21:58 -0700 Subject: [PATCH] gh-93118: [Enum] fix error message (GH-93138) Include member names in error message. (cherry picked from commit a49721ea075a18a7787ace6752b4eb0954e1b607) Co-authored-by: Ethan Furman --- Lib/enum.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/enum.py b/Lib/enum.py index 43cd1bc2b1e313f..31923d757f803ef 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)