Skip to content
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

Port the standard library to PEP 489 multiphase initialization #76043

Closed
Dormouse759 mannequin opened this issue Oct 24, 2017 · 6 comments
Closed

Port the standard library to PEP 489 multiphase initialization #76043

Dormouse759 mannequin opened this issue Oct 24, 2017 · 6 comments
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@Dormouse759
Copy link
Mannequin

Dormouse759 mannequin commented Oct 24, 2017

BPO 31862
Nosy @ncoghlan, @vstinner, @encukou, @Dormouse759
PRs
  • bpo-31862: Port binascii to PEP 489 multiphase initialization #4108
  • Superseder
  • bpo-1635741: Py_Finalize() doesn't clear all Python objects at exit
  • 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 = None
    closed_at = <Date 2020-09-07.13:55:38.744>
    created_at = <Date 2017-10-24.15:08:56.007>
    labels = ['extension-modules', 'type-feature', '3.7']
    title = 'Port the standard library to PEP 489 multiphase initialization'
    updated_at = <Date 2020-09-07.13:55:38.743>
    user = 'https://github.com/Dormouse759'

    bugs.python.org fields:

    activity = <Date 2020-09-07.13:55:38.743>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-09-07.13:55:38.744>
    closer = 'vstinner'
    components = ['Extension Modules']
    creation = <Date 2017-10-24.15:08:56.007>
    creator = 'Dormouse759'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31862
    keywords = ['patch']
    message_count = 6.0
    messages = ['304914', '304916', '343182', '376487', '376488', '376489']
    nosy_count = 4.0
    nosy_names = ['ncoghlan', 'vstinner', 'petr.viktorin', 'Dormouse759']
    pr_nums = ['4108']
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '1635741'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31862'
    versions = ['Python 3.7']

    @Dormouse759
    Copy link
    Mannequin Author

    Dormouse759 mannequin commented Oct 24, 2017

    PEP-489 introduced multiphase initialization of extension and built-in modules.
    Now, almost no module in the standard library supports this feature. This should be improved to prepare Python for better testing of subinterpreters.

    Many benefits of PEP-489 don't apply to stdlib modules. However, the PEP effectively says that by using multi-phase init, the module author "promises" that the module is "subinterpreter-friendly" 0. So, when porting, each module should be checked that it e.g. doesn't use mutable process-global state.

    I'd like to port stdlib to multi-phase init, starting with the easier modules, to:
    - get familiar with contributing to CPython,
    - check and track which modules are already "subinterpreter-friendly", and
    - figure out how and where PEP-489 is lacking (beyond what is discussed in the PEP itself).

    @Dormouse759 Dormouse759 mannequin added 3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Oct 24, 2017
    @encukou
    Copy link
    Member

    encukou commented Oct 24, 2017

    FWIW, Marcel is an intern in my team, tasked to learn CPython internals by trying to improve subinterpreter support. If I don't comment on his issues it's because we discussed privately beforehand.

    @encukou
    Copy link
    Member

    encukou commented May 22, 2019

    New changeset 33e71e0 by Petr Viktorin (Marcel Plch) in branch 'master':
    bpo-31862: Port binascii to PEP-489 multiphase initialization (GH-4108)
    33e71e0

    @vstinner
    Copy link
    Member

    vstinner commented Sep 7, 2020

    I marked bpo-15681 "PEP-3121 refactoring applied to binascii module" as a duplicate of this issue.

    @vstinner
    Copy link
    Member

    vstinner commented Sep 7, 2020

    See also bpo-1635741 "Py_Finalize() doesn't clear all Python objects at exit": many extension modules have been ported to multi-phase initialization API (PEP-489) there.

    @vstinner
    Copy link
    Member

    vstinner commented Sep 7, 2020

    I prefer to track the work in a single issue. Even if bpo-1635741 contains many unrelated changes, I prefer to continue to use bpo-1635741 to track the work on "porting the standard library to PEP-489 multiphase initialization".

    @vstinner vstinner closed this as completed Sep 7, 2020
    @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.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants