Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-105497: [Enum] Fix flag mask inversion when unnamed flags exist#106468

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ambv merged 2 commits intopython:mainfromethanfurman:enum-invert
Jul 11, 2023

Conversation

@ethanfurman
Copy link
Member

@ethanfurmanethanfurman commentedJul 5, 2023
edited by bedevere-bot
Loading

For example:

class Flag(enum.Flag):    A = 0x01    B = 0x02    MASK = 0xff~Flag.MASK is Flag(0)

This restores 3.10 behavior:

~Flag.A = <Flag.B: 2>(~Flag.A).value = 2~Flag.A is Flag.B = True~Flag.A == Flag.B = True~Flag.Mask = <Flag.0: 0>(~Flag.Mask).value = 0~Flag.Mask is Flag(0) = True~Flag.Mask == Flag(0) = True

For example:    class Flag(enum.Flag):        A = 0x01        B = 0x02        MASK = 0xff    ~Flag.MASK is Flag(0)
@ethanfurmanethanfurman added type-bugAn unexpected behavior, bug, or error stdlibStandard Library Python modules in the Lib/ directory 3.11only security fixes 3.12only security fixes needs backport to 3.11only security fixes 3.13bugs and security fixes needs backport to 3.12only security fixes labelsJul 5, 2023
@ethanfurmanethanfurman self-assigned thisJul 5, 2023
@ethanfurmanethanfurman requested review fromambv andhugovkJuly 5, 2023 21:45
@ethanfurman
Copy link
MemberAuthor

That last commit should sayIntFlag is KEEP --Enum s don't have boundaries.

@ambvambv merged commit95b7426 intopython:mainJul 11, 2023
@miss-islington
Copy link
Contributor

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJul 11, 2023
…ist (pythonGH-106468)For example:    class Flag(enum.Flag):        A = 0x01        B = 0x02        MASK = 0xff    ~Flag.MASK is Flag(0)(cherry picked from commit95b7426)Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
@bedevere-bot
Copy link

GH-106620 is a backport of this pull request to the3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestJul 11, 2023
…ist (pythonGH-106468)For example:    class Flag(enum.Flag):        A = 0x01        B = 0x02        MASK = 0xff    ~Flag.MASK is Flag(0)(cherry picked from commit95b7426)Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
@bedevere-botbedevere-bot removed the needs backport to 3.12only security fixes labelJul 11, 2023
@bedevere-bot
Copy link

GH-106621 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelJul 11, 2023
Yhg1s pushed a commit that referenced this pull requestJul 11, 2023
…xist (GH-106468) (#106620)gh-105497: [Enum] Fix flag mask inversion when unnamed flags exist (GH-106468)For example:    class Flag(enum.Flag):        A = 0x01        B = 0x02        MASK = 0xff    ~Flag.MASK is Flag(0)(cherry picked from commit95b7426)Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Yhg1s pushed a commit that referenced this pull requestJul 11, 2023
…xist (GH-106468) (#106621)gh-105497: [Enum] Fix flag mask inversion when unnamed flags exist (GH-106468)For example:    class Flag(enum.Flag):        A = 0x01        B = 0x02        MASK = 0xff    ~Flag.MASK is Flag(0)(cherry picked from commit95b7426)Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
@ethanfurmanethanfurman deleted the enum-invert branchFebruary 1, 2024 01:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ambvambvAwaiting requested review from ambv

@hugovkhugovkAwaiting requested review from hugovk

Assignees

@ethanfurmanethanfurman

Labels

3.11only security fixes3.12only security fixes3.13bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@ethanfurman@miss-islington@bedevere-bot@ambv

[8]ページ先頭

©2009-2025 Movatter.jp