This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Enum: ensure bitwise operators on subclasses are correct
Type: behavior Stage: patch review
Components: Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: ethan.furman
Priority: normal Keywords: patch

Created on 2022-01-23 00:37 by ethan.furman, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 30816 merged ethan.furman, 2022-01-23 01:39
Messages (2)
msg411319 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2022-01-23 00:37
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
msg411333 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2022-01-23 02:27
New changeset 353e3b2820bed38da16140276786eef9ba33d3bd by Ethan Furman in branch 'main':
bpo-46477: [Enum] ensure Flag subclasses have correct bitwise methods (GH-30816)
https://github.com/python/cpython/commit/353e3b2820bed38da16140276786eef9ba33d3bd
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90635
2022-01-23 02:27:57ethan.furmansetmessages: + msg411333
2022-01-23 01:39:52ethan.furmansetkeywords: + patch
stage: patch review
pull_requests: + pull_request29003
2022-01-23 00:37:08ethan.furmancreate