Repository navigation
fix(core): generate correct string values for StrEnum backport on Python 3.10 - #60
Merged
Merged
Conversation
Contributor
|
JacobCoffee
force-pushed
the
fix/strenum-auto-value-py310
branch
from
October 11, 2026 03:23
6822c2a to
0ab56e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Python 3.10 (before the stdlib
enum.StrEnumexists), this project falls back to a customStrEnum(str, Enum)backport. That backport did not override_generate_next_value_, soauto()fell back to the default integer generator (1, 2, 3, ...) instead of the lowercase member name that the realenum.StrEnumproduces on 3.11+.Effect: on Python 3.10 only,
WorkflowStatus.PENDING,StepStatus.*, andStepType.*stringified as'1','2', etc. instead of'pending','running', etc. This broke JSON/DTO serialization and any string comparisons (e.g.status == 'pending') for 3.10 users specifically — 3.11+ was never affected since it uses the real stdlibStrEnum.Fix: add a
_generate_next_value_static method to the 3.10 backport that lowercases the member name, matching stdlibenum.StrEnumbehavior exactly. No change to 3.11+ (unaffected, uses stdlib class) or to any explicitly-valued enum members (there are none here).Verified locally: full test suite now passes on Python 3.10 (458 passed, 0 failed — previously 13 failed) and still passes on 3.11/3.15, plus ruff/ty clean.