On 3.10, iterating an IntFlag enum will include multi-bit aliases but on 3.11 and above, multi-bit aliases aren't included. Since IntFlag enums shouldn't list multi-bit aliases 3.10 should be patched so its behaviour matches that of 3.11 and 3.12.
83d544b introduced the error when creating the enum but the underlying issue is that multi-bit flags aren't included when iterating the enum. eea8148 Introduced support for multi-bit members but they weren't listed with the enum. On 3.10 this was fixed in 9bf7c2d and remained fixed in 2a9ab75. But it was never fixed in 3.11 and above.
Actually, @ethanfurman, which is (or should be?) the correct behaviour when listing IntFlag enums with multi-bit members? This is what happens on Python 3.10.4
On 3.10, iterating an IntFlag enum will include multi-bit aliases but on 3.11 and above, multi-bit aliases aren't included. Since IntFlag enums shouldn't list multi-bit aliases 3.10 should be patched so its behaviour matches that of 3.11 and 3.12.
Tested on Linux with 3.10 and compared with behaviour in 3.11 and 3.12
Copied from #93035
83d544b introduced the error when creating the enum but the underlying issue is that multi-bit flags aren't included when iterating the enum. eea8148 Introduced support for multi-bit members but they weren't listed with the enum. On 3.10 this was fixed in 9bf7c2d and remained fixed in 2a9ab75. But it was never fixed in 3.11 and above.
The problem might be around here
cpython/Lib/enum.py
Lines 713 to 727 in b96e20c
I will try looking more into it later and I think an extra test should be added for this.
Originally posted by @dignissimus in #93035 (comment)
Bug report
Actually, @ethanfurman, which is (or should be?) the correct behaviour when listing IntFlag enums with multi-bit members? This is what happens on Python 3.10.4
And on trunk
Originally posted by @dignissimus in #93035 (comment)
@ethanfurman How should the following work? (should it work?)
My current patch produces the following
Behaviour with single-bit members is correct
Originally posted by @dignissimus in #93035 (comment)
The text was updated successfully, but these errors were encountered: