[mypyc] Fixing check for enum classes.#18178
Merged
hauntsaninja merged 2 commits intopython:masterfrom Nov 27, 2024
Merged
Conversation
Contributor
Author
|
@JukkaL @hauntsaninja : This PR is ready for review. Please take a look. Sorry for multiple edits and updates. It took some tries to get all tests to pass. |
hauntsaninja
approved these changes
Nov 27, 2024
Collaborator
hauntsaninja
left a comment
There was a problem hiding this comment.
Thanks! Not too familiar with mypyc, but it's definitely weird that it's passing the whole MRO as bases. Looks like it's there in this PR https://github.com/mypyc/mypyc/pull/657/files
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.
Fixes mypyc/mypyc#1065
Fixes mypyc/mypyc#1059
Fixes mypyc/mypyc#1022
is_enumflag instead offullnameof base class. That way, mypyc recognizes classes derived fromIntEnumas enum classes too.__prepare__function. For example, for thePlayertest class added in this PR, mypyc was generating C code to call__prepare__of the base class with(IntEnum, int, Enum)instead of just(IntEnum,). This bug has been fixed inclassdef.py:populate_non_ext_bases.