Repository navigation
fix(native_enum): name the enum and member on a duplicate member - #6239
Open
kroplabeskidu wants to merge 1 commit into
Open
kroplabeskidu wants to merge 1 commit into
kroplabeskidu wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Description
Fixes #5853. Calling
.value()twice with the same name on apy::native_enumfails insideenum.Enum(...)with a message that names neither the enum nor the binding:During module init this ends up as
ImportError: initialization failed, which makes the duplicate hard to find.finalize()now checks for duplicates first and uses the same format as the othernative_enumerrors:The check runs once in
finalize()using a set, so it doesn't make.value()quadratic for large enums.Suggested changelog entry:
py::native_enumnow names the enum and member when a member name is registered twice.