From: Tobin Yehle Date: Wed, 25 May 2022 01:16:20 +0000 (-0600) Subject: gh-93035: [Enum] Fix IntFlag crash when no single-bit members (GH-93076) X-Git-Tag: v3.12.0a1~1437 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08cfc3dabf0f81a4494cd0d697befc7d0dec77b7;p=thirdparty%2FPython%2Fcpython.git 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). --- diff --git a/Lib/enum.py b/Lib/enum.py index 64b44197df52..0b97d3d8a68e 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -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.