-
-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
[Enum] verify'ing a Flag class with negative values results in MemoryError #99248
Labels
performance
Performance or resource usage
stdlib
Python modules in the Lib dir
type-bug
An unexpected behavior, bug, or error
Comments
The problem is that 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 |
ethanfurman
added a commit
that referenced
this issue
Nov 8, 2022
[Enum] fix negative number infinite loop - _iter_bits_lsb() now raises a ValueError if a negative number is passed in - verify() now skips checking negative numbers for named flags
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 8, 2022
) [Enum] fix negative number infinite loop - _iter_bits_lsb() now raises a ValueError if a negative number is passed in - verify() now skips checking negative numbers for named flags (cherry picked from commit 0b4ffb0) Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
miss-islington
added a commit
that referenced
this issue
Nov 8, 2022
[Enum] fix negative number infinite loop - _iter_bits_lsb() now raises a ValueError if a negative number is passed in - verify() now skips checking negative numbers for named flags (cherry picked from commit 0b4ffb0) Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Thanks for the report. Fix merged into main and 3.11. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
performance
Performance or resource usage
stdlib
Python modules in the Lib dir
type-bug
An unexpected behavior, bug, or error
Bug report
A clear and concise description of what the bug is.
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.
Your environment
In this example, it is working good, if RED has value of 0, but is resulting in Memory Error, if its value is changed to -1
The text was updated successfully, but these errors were encountered: