markshannon · GitHub

Currently we don't specialize loading of enum attributes.

class Color(Enum):
     RED = "Red"
Color.RED   # This load is not specialized

We can take advantage of the fact that type(Color.RED) == Color when specializing.
Since we check the version number of Color in LOAD_ATTR_CLASS, we are implicitly checking the version of type(Color.RED).
If Color.RED is 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

Read the original on github.com ↗