-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-93035: Fix IntFlag crash with no single bit members #93076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Lib/enum.py
Outdated
@@ -577,22 +577,24 @@ def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **k | |||
attributes -- see the documentation for details. | |||
""") | |||
else: | |||
member = list(enum_class)[0] | |||
enum_length = len(enum_class) | |||
# avoid list(enum_class) because that doesn't include aliases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aliases should not be included, and are not considered part of the length of the Flag
.
This issue will need to be fixed a different way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to just fallback to the default docstring in this case
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Thanks @tyehle for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
GH-93197 is a backport of this pull request to the 3.11 branch. |
Thanks @tyehle for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
…ythonGH-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). (cherry picked from commit 08cfc3d) Co-authored-by: Tobin Yehle <tobinyehle@gmail.com>
Fixes #93035 by changing automatic docstring generation of enums to include aliases in examples.