Reworked Enum marshaling by lostmsu · Pull Request #1392 · pythonnet/pythonnet

@lostmsu lostmsu marked this pull request as ready for review

February 21, 2021 01:04

@lostmsu

- enums are no longer converted to and from PyLong automatically pythonnet#1220
- one can construct an instance of MyEnum from Python using MyEnum(numeric_val), e.g. MyEnum(10)
- in the above, if MyEnum does not have [Flags] and does not have value 10 defined, to create MyEnum with value 10 one must call MyEnum(10, True). Here True is an unnamed parameter, that allows unchecked conversion
- legacy behavior has been moved to a codec (EnumPyLongCodec); enums can now be encoded by codecs
- flags enums support bitwise ops via EnumOps class

@lostmsu lostmsu deleted the PR/Disable-Enum-Implicit-Conv-To-Int branch

March 30, 2021 23:49