You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Enum] verify'ing a Flag class with negative values results in MemoryError #99248
) doesn't terminate for negative numbers, the number just grows unbounded.
Negative numbers don't really make sense as OR-able flags (which are conceptually unsigned), but we should fail with an obvious error instead of using all available memory.
changed the title [-]Enum Flag class with one negative value is resulting in Memory Error[/-][+][Enum] verify'ing a Flag class with negative values results in MemoryError[/+]on Nov 8, 2022
Activity
JelleZijlstra commentedon Nov 8, 2022
The problem is that
enum._iter_bits_lsb(cpython/Lib/enum.py
Line 116 in c43714f
Negative numbers don't really make sense as OR-able flags (which are conceptually unsigned), but we should fail with an obvious error instead of using all available memory.
cc @ethanfurman for enums
[-]Enum Flag class with one negative value is resulting in Memory Error[/-][+][Enum] verify'ing a Flag class with negative values results in MemoryError[/+]gh-99248: [Enum] fix negative number infinite loop (GH-99256)
pythongh-99248: [Enum] fix negative number infinite loop (pythonGH-99256
gh-99248: [Enum] fix negative number infinite loop (GH-99256)
ethanfurman commentedon Nov 8, 2022
Thanks for the report. Fix merged into main and 3.11.