8000 [3.11] gh-93035: [Enum] Fix IntFlag crash when no single-bit members … · python/cpython@37a7f1b · GitHub
[go: up one dir, main page]

Skip to content

Commit 37a7f1b

Browse files
[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 08cfc3d) Co-authored-by: Tobin Yehle <tobinyehle@gmail.com>
1 parent 0fb70ce commit 37a7f1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **k
538538
#
539539
# create a default docstring if one has not been provided
540540
if enum_class.__doc__ is None:
541-
if not member_names:
541+
if not member_names or not list(enum_class):
542542
enum_class.__doc__ = classdict['__doc__'] = _dedent("""\
543543
Create a collection of name/value pairs.
544544

0 commit comments

Comments
 (0)
0