Skip to content

.NET enums should not be automatically converted to Python int and back #1220

Closed
@lostmsu

Description

@lostmsu

From #1179

In Python, it should be possible to refer to enum members: MyEnum.Member, and to create arbitrary enum values from int explicitly like this: MyEnum(42). But by default a number and a value of some enum should not be freely convertible to each other. E.g. this should fail:

void Method(MyEnum value) => ...;

Python:

Method(42); # <- this should be a TypeError

We can add a generic enum codec, that could be enabled on demand to restore old behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions