Title: Port the standard library to PEP 489 multiphase initialization
Type: enhancement Stage: patch review
Components: Extension Modules Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Dormouse759, ncoghlan, petr.viktorin
Priority: normal Keywords: patch

Created on 2017-10-24 15:08 by Dormouse759, last changed 2020-01-16 16:39 by Mariatta.

Pull Requests
URL Status Linked Edit
PR 4108 merged Dormouse759, 2017-10-24 15:18
Messages (3)
msg304914 - (view) Author: Marcel Plch (Dormouse759) * Date: 2017-10-24 15:08
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).

msg304916 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2017-10-24 15:15
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.
msg343182 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2019-05-22 11:51
New changeset 33e71e01e95506cf8d93fd68251fc56352bc7b39 by Petr Viktorin (Marcel Plch) in branch 'master':
bpo-31862: Port binascii to PEP 489 multiphase initialization (GH-4108)
Date User Action Args
2020-01-16 16:39:59Mariattasetpull_requests: - pull_request13420
2019-05-22 19:47:12sir-sigurdsetpull_requests: + pull_request13420
2019-05-22 11:51:36petr.viktorinsetmessages: + msg343182
2017-10-24 15:18:34Dormouse759setkeywords: + patch
stage: patch review
pull_requests: + pull_request4078
2017-10-24 15:15:52petr.viktorinsetmessages: + msg304916
2017-10-24 15:08:56Dormouse759create