summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2021-01-13 07:47:57 (GMT)
committerGitHub <noreply@github.com>2021-01-13 07:47:57 (GMT)
commitc314e60388282d9829762fb6c30b12e2807caa19 (patch)
tree1c49d06b9882fec1c77d0a091baf9c0b93230e4f /Lib/inspect.py
parentc47c78b878ff617164b2b94ff711a6103e781753 (diff)
downloadcpython-c314e60388282d9829762fb6c30b12e2807caa19.zip
cpython-c314e60388282d9829762fb6c30b12e2807caa19.tar.gz
cpython-c314e60388282d9829762fb6c30b12e2807caa19.tar.bz2
bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196)
`type.__new__` calls `__set_name__` and `__init_subclass__`, which means that any work metaclasses do after calling `super().__new__()` will not be available to those two methods. In particular, `Enum` classes that want to make use of `__init_subclass__` will not see any members. Almost all customization is therefore moved to before the `type.__new__()` call, including changing all members to a proto member descriptor with a `__set_name__` that will do the final conversion of a member to be an instance of the `Enum` class.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 70c5ef7..1f2cdeb 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -408,7 +408,7 @@ def classify_class_attrs(cls):
# attribute with the same name as a DynamicClassAttribute exists.
for base in mro:
for k, v in base.__dict__.items():
- if isinstance(v, types.DynamicClassAttribute):
+ if isinstance(v, types.DynamicClassAttribute) and v.fget is not None:
names.append(k)
result = []
processed = set()