Visitar URL original
Isolate Stdlib Extension Modules · Issue #103092 · python/cpython · GitHub
Skip to content

Isolate Stdlib Extension Modules #103092

Description

@ericsnowcurrently

See PEP 687.

Currently most stdlib extension have been ported to multi-phase init. There are still a number of them to be ported, almost entirely non-builtin modules. Also, some that have already been ported still have global state that needs to be fixed.

(This is part of the effort to finish isolating multiple interpreters from each other. See gh-100227.)

High-Level Info

How to isolate modules: https://docs.python.org/3/howto/isolating-extensions.html (AKA PEP 630).

The full list of modules that need porting can be found with: ...

The full list of remaining (unsupported) global variables is:

A full analysis of the modules may be found at the bottom of this post.

(other info)

Previous Work

Related Links

TODO

Here is the list of modules that need attention, in a rough, best-effort priority order. Additional details (e.g. if there is an issue and/or PR) is found in the analysis table at the bottom.

The above does not include test modules. They don't need to be ported/isolated (except for a few which already have been).


Modules Analysis

module builtin Windows PEP 594 issue PR ported # static types # other global objects # other globals
_asyncio yes 2
_collections X (???) (branch) yes 7
_ctypes **NO** 37 6 4
_curses **NO** 1 2 4
_curses_panel yes 1
_datetime gh-71587 gh-102995 **NO** 7 10 1
_decimal **NO** 4 10 6
_elementtree yes 1
_io X gh-101819 gh-101520 **NO** 5
_lsprof yes 2
_multibytecodec yes 23
_pickle (???) (yes) **NO** 5
_socket **NO** 1 2 3
_ssl (???) (branch) yes 1
_tkinter **NO** 8 9
_tracemalloc X gh-101520 **NO** 6 7
array yes 1
faulthandler X gh-101509 yes 3+ ~22+
msvcrt Y **NO** ??? ??? ???
pyexpat yes 1
readline **NO** 9
winreg Y **NO** ??? ??? ???
winsound Y **NO** ??? ??? ???
test/example modules

These can be ported/isolated but don't have to be. They are the lowest priority.

module issue PR ported # static types # other global objects # other globals
xxmodule 3 1
xxsubtype 2
xxlimited_35 2
...
...

Linked PRs

Activity

  1. ericsnowcurrently commented on Mar 28, 2023

    @ericsnowcurrently
    MemberAuthor

    Ideally we'll get most of this done for 3.12. FWIW, there isn't enough time if it's just me, so consider this a call out to whoever can help. 😄 Feel free to adjust the TODO list and (hidden) "analysis" table above. Also feel free to reach out to any others that might be interested in pitching in here. Thanks!!!

    @erlend-aasland, @corona10, @kumaraditya303, etc.

  2. ericsnowcurrently commented on Mar 28, 2023

    @ericsnowcurrently
    MemberAuthor

    @terryjreedy (for _tkinter)

  3. erlend-aasland commented on Mar 28, 2023

    @erlend-aasland
    Contributor

    I've got WIP branches for datetime, io, pickle, collections, and ssl. The three former are up as draft PRs.

    (FYI, I have quite a bit of CPython time scheduled for next week.)

  4. ericsnowcurrently commented on Mar 28, 2023

    @ericsnowcurrently
    MemberAuthor
  5. erlend-aasland commented on Mar 28, 2023

    @erlend-aasland
    Contributor

    Regarding the freelists in _asyncio, Kumar and Guido had some thoughts over at #91375 (comment).

  6. erlend-aasland commented on Mar 28, 2023

    @erlend-aasland
    Contributor

    Elementtree was isolated/ported in gh-92123.

  7. erlend-aasland commented on Mar 28, 2023

    @erlend-aasland
    Contributor

    _lsprof is also done, AFAICS. ... just noticed rotatingtree.c; sorry 'bout the noise.

  8. ericsnowcurrently commented on Mar 28, 2023

    @ericsnowcurrently
    MemberAuthor

    Thanks for the updates!

  9. terryjreedy commented on Mar 28, 2023

    @terryjreedy
    Member

    @serhiy-storchaka for _tkinter. I have nothing to do with it.

  10. erlend-aasland commented on Mar 29, 2023

    @erlend-aasland
    Contributor

    AFAICS, array should be fine; array_reconstructor is in the module state already.

  11. corona10 commented on Mar 29, 2023

    @corona10
    Member

    I will try to find which modules that I can support for this issue :)

  12. erlend-aasland commented on Mar 29, 2023

    @erlend-aasland
    Contributor

    I will try to find which modules that I can support for this issue :)

    Feel free to pick up any of my draft PRs! :)

  13. 95 remaining items

  14. ericsnowcurrently commented on May 6, 2024

    @ericsnowcurrently
    MemberAuthor

    Which modules are we talking about? You referenced this from a _datetime change that didn't seem to actually switch to multi-phase init.

    datetime and ctypes. Those are the only two left from the list at the top of this issue.

  15. added 5 commits that reference this issue on Sep 2, 2024
  16. removed
    3.12only security fixes
    3.13only security fixes
    on Dec 26, 2024
  17. added a commit that references this issue on May 8, 2025
  18. added a commit that references this issue on May 8, 2025
  19. added a commit that references this issue on May 8, 2025
  20. added a commit that references this issue on Jul 12, 2025
  21. kumaraditya303 commented on Jul 22, 2025

    @kumaraditya303
    Contributor

    _datetime and _ctypes have been ported so this is completed now.

  22. added a commit that references this issue on Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions