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:
Miss Islington (bot) 2022-05-23 14:37:18 -07:00 committed by GitHub
parent cea65730a7
commit b8c4cc6b76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)