Skip to content

Conversation

@jtdavis777
Copy link
Collaborator

@jtdavis777 jtdavis777 commented Nov 18, 2025

Fixes #8617 and addresses #5083

This PR has enum types inherit from IntEnum or (IntFlag for bit_flags) directly, instead of just providing this as type hinting, and changes the setter function signatures to require enum types. This code should still be backward and forward compatible on receipt, as ints are still returned by the getters.

This code, chiefly, allows users to go to and from string string values to the enum values, but also provides some runtime type safety (over just type hint safety).

@github-actions github-actions bot added c++ codegen Involving generating code from schema python labels Nov 18, 2025
@fliiiix
Copy link
Contributor

fliiiix commented Nov 18, 2025

Some docs at least in docs/source/flatc.md would be nice for this change

@fliiiix
Copy link
Contributor

fliiiix commented Nov 18, 2025

I played around a bit and it seemed fine, i couldn't integrated it into our main product because this crate was not updated yet rdelfin/flatbuffers-build#30

@jtdavis777 jtdavis777 changed the title [Python] generate enums as IntEnum type when requested [Python] generate enums as IntEnum or IntFlag type when requested Nov 20, 2025
@github-actions github-actions bot added the documentation Documentation label Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema documentation Documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python] FBS Enums are of underlying type, not of enum type

2 participants