gh-93035: [Enum] Fix IntFlag crash when no single-bit members (GH-93076)

`EnumType` attempts to create a custom docstring for each enum/flag, but that was failing with pathological flags that had no members (only multi-bit aliases).
This commit is contained in:
Tobin Yehle 2022-05-24 19:16:20 -06:00 committed by GitHub
parent 4a31ed8a32
commit 08cfc3dabf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -538,7 +538,7 @@ class EnumType(type):
#
# create a default docstring if one has not been provided
if enum_class.__doc__ is None:
if not member_names:
if not member_names or not list(enum_class):
enum_class.__doc__ = classdict['__doc__'] = _dedent("""\
Create a collection of name/value pairs.