Skip to content

Fix serialization of composite flag members - #601

Open
jakezwang wants to merge 1 commit into
cloudpipe:masterfrom
jakezwang:fix/intflag-member-serialization
Open

jakezwang wants to merge 1 commit into
cloudpipe:masterfrom
jakezwang:fix/intflag-member-serialization

Conversation

@jakezwang

Copy link
Copy Markdown

Iterating over a flag enum omits zero-valued members, composite members, and aliases. Using that iteration to serialize the definition leaves members out of the constructor arguments and in the state restored afterward, which can raise AttributeError: cannot reassign member.

Use __members__ for both steps. Tests cover Flag and IntFlag with zero, composite and aliased values, including reconstruction in a separate process and both pickle protocols.

Fixes #558.

Validation: full test suites on Python 3.8, 3.11, 3.13 and 3.14; pre-commit checks for the changed files; wheel and sdist validation.

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

Successfully merging this pull request may close these issues.

IntFlag Enum - broken after py3.11

1 participant