diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-05-25 17:50:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-25 17:50:24 (GMT) |
commit | 37a7f1b0997466bb088df82f5fe35fe6d1cebb22 (patch) | |
tree | 0766f0a20bbbd52be3fae48925a19814082054f9 /Lib/enum.py | |
parent | 0fb70ce19197e97b6254ecd2c12f6e8c5b07ef5b (diff) | |
download | cpython-37a7f1b0997466bb088df82f5fe35fe6d1cebb22.zip cpython-37a7f1b0997466bb088df82f5fe35fe6d1cebb22.tar.gz cpython-37a7f1b0997466bb088df82f5fe35fe6d1cebb22.tar.bz2 |
[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 08cfc3dabf0f81a4494cd0d697befc7d0dec77b7)
Co-authored-by: Tobin Yehle <tobinyehle@gmail.com>
Diffstat (limited to 'Lib/enum.py')
-rw-r--r-- | Lib/enum.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index 31923d7..4a21226 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -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. |