Skip to content

[3.9] bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)#23772

Merged
ethanfurman merged 2 commits into
python:3.9from
ethanfurman:backport-6bd94de-3.9
Dec 15, 2020
Merged

[3.9] bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)#23772
ethanfurman merged 2 commits into
python:3.9from
ethanfurman:backport-6bd94de-3.9

Conversation

@ethanfurman

@ethanfurman ethanfurman commented Dec 15, 2020

Copy link
Copy Markdown
Member

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.

(cherry picked from commit 6bd94de)

https://bugs.python.org/issue42567

pythonGH-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..
(cherry picked from commit 6bd94de)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
@ethanfurman
ethanfurman merged commit 9d1fff1 into python:3.9 Dec 15, 2020
@ethanfurman
ethanfurman deleted the backport-6bd94de-3.9 branch December 15, 2020 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants