]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)
authorEthan Furman <ethan@stoneleaf.us>
Thu, 10 Dec 2020 00:41:22 +0000 (16:41 -0800)
committerGitHub <noreply@github.com>
Thu, 10 Dec 2020 00:41:22 +0000 (16:41 -0800)
commit6bd94de168b58ac9358277ed6f200490ab26c174
tree01dfe448e2651e084d9d8e34eb7a301b2c6cc6c7
parent2a35137328154aa2513649dcf0bbef02c998e27c
bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)

When creating an Enum, type.__new__ calls __init_subclass__, but at that point the members have not been added.

This patch suppresses the initial call, then manually calls the ancestor __init_subclass__ before returning the new Enum class.
Lib/enum.py
Lib/test/test_enum.py
Misc/NEWS.d/next/Library/2020-12-08-22-43-35.bpo-42678.ba9ktU.rst [new file with mode: 0644]