-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Specialize access to Enum attributes #95004
Copy link
Copy link
Closed
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage
Fields
Give feedbackNo fields configured for issues without a type.
Currently we don't specialize loading of enum attributes.
We can take advantage of the fact that
type(Color.RED) == Colorwhen specializing.Since we check the version number of
ColorinLOAD_ATTR_CLASS, we are implicitly checking the version oftype(Color.RED).If
Color.REDis not a descriptor when specialized, it will not be a descriptor when executed.Therefore, we can specialize it in the same way as immutable, non-descriptor class attributes using
LOAD_ATTR_CLASS.@Fidget-Spinner
@brandtbucher
Linked PRs