mirror of
https://github.com/python/cpython.git
synced 2025-11-02 06:31:29 +00:00
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).
This commit is contained in:
parent
4a31ed8a32
commit
08cfc3dabf
1 changed files with 1 additions and 1 deletions
|
|
@ -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.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue