Skip to content

[Enum] move member creation to __set_name__ in order to support __init_subclass__ #87067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ethanfurman opened this issue Jan 12, 2021 · 3 comments
Assignees
Labels
3.10 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ethanfurman
Copy link
Member

BPO 42901
Nosy @warsaw, @ethanfurman, @hroncok
PRs
  • bpo-42901: [Enum] move member creation to __set_name__ #24196
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ethanfurman'
    closed_at = <Date 2021-01-25.23:13:30.087>
    created_at = <Date 2021-01-12.01:27:28.386>
    labels = ['type-feature', 'library', '3.10']
    title = '[Enum] move member creation to __set_name__ in order to support __init_subclass__'
    updated_at = <Date 2021-02-08.12:41:34.225>
    user = 'https://github.com/ethanfurman'

    bugs.python.org fields:

    activity = <Date 2021-02-08.12:41:34.225>
    actor = 'hroncok'
    assignee = 'ethan.furman'
    closed = True
    closed_date = <Date 2021-01-25.23:13:30.087>
    closer = 'ethan.furman'
    components = ['Library (Lib)']
    creation = <Date 2021-01-12.01:27:28.386>
    creator = 'ethan.furman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42901
    keywords = ['patch']
    message_count = 3.0
    messages = ['384875', '385006', '386629']
    nosy_count = 4.0
    nosy_names = ['barry', 'eli.bendersky', 'ethan.furman', 'hroncok']
    pr_nums = ['24196']
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue42901'
    versions = ['Python 3.10']

    @ethanfurman
    Copy link
    Member Author

    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__.

    @ethanfurman ethanfurman added the 3.10 only security fixes label Jan 12, 2021
    @ethanfurman ethanfurman self-assigned this Jan 12, 2021
    @ethanfurman ethanfurman added stdlib Python modules in the Lib dir type-feature A feature request or enhancement 3.10 only security fixes labels Jan 12, 2021
    @ethanfurman ethanfurman self-assigned this Jan 12, 2021
    @ethanfurman ethanfurman added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 12, 2021
    @ethanfurman
    Copy link
    Member Author

    New changeset c314e60 by Ethan Furman in branch 'master':
    bpo-42901: [Enum] move member creation to __set_name__ (GH-24196)
    c314e60

    @hroncok
    Copy link
    Mannequin

    hroncok mannequin commented Feb 8, 2021

    I found a possible regression: https://bugs.python.org/issue43162

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant