[issue44242] enum.IntFlag regression: missing values cause TypeError
Ethan Furman
report at bugs.python.org
Wed May 26 17:35:05 EDT 2021
Ethan Furman <ethan at stoneleaf.us> added the comment:
Actually, thinking about that a little bit more, KEEP was added for exactly this situation, as some stdlib flags exhibit the same behavior.
So the real question is what should happen with, for example,
GeodIntermediateFlag(0x80)
?
The idea behind boundary is what should happen when values are created that don't have names in the Enum/Flag? The options for boundary are:
STRICT -> an error is raised (default for Enum)
EJECT -> the integer 0x80 is returned (not a flag)
CONFORM -> unnamed bits are discarded (so the DEFAULT flag would be returned)
KEEP -> an unnamed flag with value 0x80 is returned
So KEEP is currently doing double-duty -- this reinforces my desire to go with option 2 and return KEEP to single-duty status.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44242>
_______________________________________
More information about the Python-bugs-list
mailing list