8000 gh-93035: Fix IntFlag crash with no single bit members by tyehle · Pull Request #93076 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 1 commit into from
May 25, 2022
Merged

gh-93035: Fix IntFlag crash with no single bit members #93076

merged 1 commit into from
May 25, 2022

Conversation

tyehle
Copy link
Contributor
@tyehle tyehle commented May 22, 2022

Fixes #93035 by changing automatic docstring generation of enums to include aliases in examples.

@tyehle tyehle requested a review from ethanfurman as a code owner May 22, 2022 17:02
@ghost
Copy link
ghost commented May 22, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

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
Copy link
Member

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.

Copy link
Contributor Author

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

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@tyehle tyehle requested a review from ethanfurman May 24, 2022 03:27
@ethanfurman ethanfurman self-assigned this May 24, 2022
@ethanfurman ethanfurman merged commit 08cfc3d into python:main May 25, 2022
@ethanfurman ethanfurman added 3.11 only security fixes 3.12 only security fixes needs backport to 3.11 only security fixes labels May 25, 2022
@miss-islington
Copy link
Contributor

Thanks @tyehle for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-93197 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 25, 2022
@ethanfurman ethanfurman added type-bug An unexpected behavior, bug, or error needs backport to 3.11 only security fixes labels May 25, 2022
@miss-islington
Copy link
Contributor

Thanks @tyehle for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2022
…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>
ethanfurman pushed a commit that referenced this pull request May 25, 2022
…H-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 08cfc3d)

Co-authored-by: Tobin Yehle <tobinyehle@gmail.com>
@tyehle tyehle deleted the 93035-fix-intflag-crash branch May 25, 2022 18:30
@ZeroIntensity ZeroIntensity removed type-bug An unexpected behavior, bug, or error 3.11 only security fixes 3.12 only security fixes needs backport to 3.11 only security fixes labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IntFlag crashes with no single bit members
5 participants
0