Skip to content
Snippets Groups Projects
Unverified Commit 37a7f1b0 authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by GitHub
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 08cfc3da)

Co-authored-by: default avatarTobin Yehle <tobinyehle@gmail.com>
parent 0fb70ce1
Branches
Tags
No related merge requests found
...@@ -538,7 +538,7 @@ def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **k ...@@ -538,7 +538,7 @@ def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **k
# #
# create a default docstring if one has not been provided # create a default docstring if one has not been provided
if enum_class.__doc__ is None: 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("""\ enum_class.__doc__ = classdict['__doc__'] = _dedent("""\
Create a collection of name/value pairs. Create a collection of name/value pairs.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment