-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[mypyc] fix IntEnum attributes not treated as final values #14745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -467,12 +467,13 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: | |||||||
| The tuple is passed to the metaclass constructor. | ||||||||
| """ | ||||||||
| is_named_tuple = cdef.info.is_named_tuple | ||||||||
| is_enum = cdef.info.is_enum | ||||||||
| ir = builder.mapper.type_to_ir[cdef.info] | ||||||||
| bases = [] | ||||||||
| for cls in cdef.info.mro[1:]: | ||||||||
| if cls.fullname == "builtins.object": | ||||||||
| continue | ||||||||
| if is_named_tuple and cls.fullname in ( | ||||||||
| if (is_named_tuple or is_enum) and cls.fullname in ( | ||||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My thoughts about this change are as the following:
Not really sure if checking against both Enums and Named tuples is generic enough or not. |
||||||||
| "typing.Sequence", | ||||||||
| "typing.Iterable", | ||||||||
| "typing.Collection", | ||||||||
|
|
@@ -630,7 +631,7 @@ def add_non_ext_class_attr( | |||||||
| # are final. | ||||||||
| if ( | ||||||||
| cdef.info.bases | ||||||||
| and cdef.info.bases[0].type.fullname == "enum.Enum" | ||||||||
| and cdef.info.bases[0].type.is_enum | ||||||||
| # Skip these since Enum will remove it | ||||||||
| and lvalue.name not in ENUM_REMOVED_PROPS | ||||||||
| ): | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should docstring change in this case ?