mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
[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:
parent
0fb70ce191
commit
37a7f1b099
1 changed files with 1 additions and 1 deletions
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue