Skip to content
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

[ENH] Allow customization of cpdef enum to Py conversions #6128

Open
da-woods opened this issue Apr 6, 2024 · 0 comments
Open

[ENH] Allow customization of cpdef enum to Py conversions #6128

da-woods opened this issue Apr 6, 2024 · 0 comments

Comments

@da-woods
Copy link
Contributor

da-woods commented Apr 6, 2024

From a user's perspective, this caused surprise for a project where we weren't using bitwise features of enums and had Python code making decisions based on whether values were iterable. After this change, our enumerations suddenly became iterable and things broke (vapoursynth/vapoursynth#1046).

It's understandable why the switch to IntFlag was made and we've worked around it but I would love if you could optionally signal plain IntEnum behavior outside of C++ context.

Originally posted by @JustinTArthur in #4877 (comment)


DW's notes:

  • It probably isn't too a hard to implement from a code-gen point of view it's just a case of finding a nice syntax. Probably just a decorator on cpdef enum?

  • We're obviously slightly at the mercy of what CPython decides to do with their enums. IntFlag wasn't actually iterable until 3.11 (which is admittedly after we started using it) so this change to behaviour is only partly of our own doing.

  • I'm not hugely convinced it's worth the extra complication right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant