8000 gh-93035: [Enum] Fix IntFlag crash when no single-bit members (GH-93076) · python/cpython@08cfc3d · GitHub
[go: up one dir, main page]

Skip to content

Commit 08cfc3d

Browse files
authored
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).
1 parent 4a31ed8 commit 08cfc3d

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