8000 Enum: ensure bitwise operators on subclasses are correct · Issue #90635 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Enum: ensure bitwise operators on subclasses are correct #90635

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

Closed
ethanfurman opened this issue Jan 23, 2022 · 2 comments
Closed

Enum: ensure bitwise operators on subclasses are correct #90635

ethanfurman opened this issue Jan 23, 2022 · 2 comments
Assignees
Labels
3.11 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@ethanfurman
Copy link
Member
BPO 46477
Nosy @ethanfurman
PRs
  • bpo-46477: [Enum] ensure Flag subclasses have correct bitwise methods #30816
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ethanfurman'
    closed_at = None
    created_at = <Date 2022-01-23.00:37:08.664>
    labels = ['type-bug', '3.11']
    title = 'Enum: ensure bitwise operators on subclasses are correct'
    updated_at = <Date 2022-01-23.02:27:57.589>
    user = 'https://github.com/ethanfurman'

    bugs.python.org fields:

    activity = <Date 2022-01-23.02:27:57.589>
    actor = 'ethan.furman'
    assignee = 'ethan.furman'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2022-01-23.00:37:08.664>
    creator = 'ethan.furman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46477
    keywords = ['patch']
    message_count = 2.0
    messages = ['411319', '411333']
    nosy_count = 1.0
    nosy_names = ['ethan.furman']
    pr_nums = ['30816']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46477'
    versions = ['Python 3.11']

    @ethanfurman
    Copy link
    Member Author

    Creating one's own int Flag type doesn't work properly with regards to the bitwise operators:

        class MyIntFlag(int, Flag):
            ONE = 1
            TWO = 2
            FOUR = 4
    MyIntFlag.ONE | MyIntFlag.TWO
    # <MyIntFlag.ONE|TWO: 3>
    
    MyIntFlag.ONE | 2
    # 3
    

    @ethanfurman ethanfurman added the 3.11 only security fixes label Jan 23, 2022
    @ethanfurman ethanfurman self-assigned this Jan 23, 2022
    @ethanfurman ethanfurman added type-bug An unexpected behavior, bug, or error 3.11 only security fixes labels Jan 23, 2022
    @ethanfurman ethanfurman self-assigned this Jan 23, 2022
    @ethanfurman ethanfurman added the type-bug An unexpected behavior, bug, or error label Jan 23, 2022
    @ethanfurman
    Copy link
    Member Author

    New changeset 353e3b2 by Ethan Furman in branch 'main':
    bpo-46477: [Enum] ensure Flag subclasses have correct bitwise methods (GH-30816)
    353e3b2

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant
    0