gh-95077: [Enum] add code-based deprecation warnings for member.member access by ethanfurman · Pull Request #95083 · python/cpython (original) (raw)
The performance speed-up added in 3.11 is removed as other improvements in Python have made it unnecessary. With that removal, it is now possible to detect when a member.member
access is attempted, and issue a warning before returning the desired member.
Each enum member is represented in the enum class dict by a custom enum.property
. The enum member itself lives in both _member_map_
and enum.property
, enabling enum.property
to skip the _member_map_
lookup.
enum.property
is a subclass of types.DynamicClassAttribute
to enable inspect
, etc., to properly investigate and document enum members and attributes (although enum.property
works completely differently).