mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-93118: [Enum] fix error message (GH-93138) (GH-93142)
Include member names in error message.
(cherry picked from commit a49721ea07
)
This commit is contained in:
parent
cea65730a7
commit
b8c4cc6b76
1 changed files with 3 additions and 2 deletions
|
@ -480,8 +480,9 @@ class EnumType(type):
|
||||||
# check for illegal enum names (any others?)
|
# check for illegal enum names (any others?)
|
||||||
invalid_names = set(member_names) & {'mro', ''}
|
invalid_names = set(member_names) & {'mro', ''}
|
||||||
if invalid_names:
|
if invalid_names:
|
||||||
raise ValueError('invalid enum member name(s) '.format(
|
raise ValueError('invalid enum member name(s) %s' % (
|
||||||
','.join(repr(n) for n in invalid_names)))
|
','.join(repr(n) for n in invalid_names)
|
||||||
|
))
|
||||||
#
|
#
|
||||||
# adjust the sunders
|
# adjust the sunders
|
||||||
_order_ = classdict.pop('_order_', None)
|
_order_ = classdict.pop('_order_', None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue