[issue44242] enum.IntFlag regression: missing values cause TypeError
Ethan Furman
report at bugs.python.org
Wed May 26 17:16:54 EDT 2021
Ethan Furman <ethan at stoneleaf.us> added the comment:
That is an intentional change. The cause is that the masks include bits that are not named in the Flag.
The user-side fix is to add a `boundary=KEEP` option to the flag:
class GeodIntermediateFlag(IntFlag, boundary=KEEP)
The enum library fix could be one of two things:
- automatically use the KEEP boundary when these conditions arise, and issue a DeprecationWarning; or
- lose that particular check.
I'm inclined to go with option 2, since `boundary` is designed to answer the question of what to do when Flag.A | Flag.B does not exist in Flag.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44242>
_______________________________________
More information about the Python-bugs-list
mailing list