[New-bugs-announce] [issue46477] Enum: ensure bitwise operators on subclasses are correct

Ethan Furman report at bugs.python.org
Sat Jan 22 19:37:08 EST 2022


New submission from Ethan Furman <ethan at stoneleaf.us>:

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

----------
assignee: ethan.furman
messages: 411319
nosy: ethan.furman
priority: normal
severity: normal
status: open
title: Enum: ensure bitwise operators on subclasses are correct
type: behavior
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46477>
_______________________________________


More information about the New-bugs-announce mailing list