classification
Title: [Enum] move member creation to __set_name__ in order to support __init_subclass__
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: barry, eli.bendersky, ethan.furman, hroncok
Priority: high Keywords: patch

Created on 2021-01-12 01:27 by ethan.furman, last changed 2021-02-08 12:41 by hroncok. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24196 merged ethan.furman, 2021-01-12 04:38
Messages (3)
msg384875 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2021-01-12 01:27
In discussions about moving the calls to `__set_name__` and `__init_subclass__`, Nick Coughlan made an observation:

Nick Coghlan:
> Both EnumMeta and ABCMeta should probably be relying on `__set_name__`
> for their per-member set up work these days, rather than deferring that
> work until after `__new__` returns.

By having `__set_name__` create the final members, they will be in place for the call to `__init_subclass__`.
msg385006 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2021-01-13 07:48
New changeset c314e60388282d9829762fb6c30b12e2807caa19 by Ethan Furman in branch 'master':
bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196)
https://github.com/python/cpython/commit/c314e60388282d9829762fb6c30b12e2807caa19
msg386629 - (view) Author: Miro HronĨok (hroncok) * Date: 2021-02-08 12:41
I found a possible regression: https://bugs.python.org/issue43162
History
Date User Action Args
2021-02-08 12:41:34hroncoksetnosy: + hroncok
messages: + msg386629
2021-01-25 23:13:30ethan.furmansetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-01-13 07:48:08ethan.furmansetmessages: + msg385006
2021-01-12 04:38:09ethan.furmansetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request23022
2021-01-12 01:29:46ethan.furmanlinkissue42775 superseder
2021-01-12 01:27:28ethan.furmancreate