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

`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).
(cherry picked from commit 08cfc3dabf)

Co-authored-by: Tobin Yehle <tobinyehle@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-05-25 10:50:24 -07:00 committed by GitHub
parent 0fb70ce191
commit 37a7f1b099
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.