Repository navigation
Isolate Stdlib Extension Modules #103092
Description
Activity
- addedtype-featureA feature request or enhancementA feature request or enhancementextension-modulesC modules in the Modules dirC modules in the Modules dir3.12only security fixesonly security fixes
on Mar 28, 2023 ericsnowcurrently commented
on Mar 28, 2023 MemberAuthorMore actionsIdeally 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.
Reacted by Erlend E. Aasland, Donghee Na, Charlie Zhao and Hai Shiericsnowcurrently commented
on Mar 28, 2023 MemberAuthorMore actions@terryjreedy (for _tkinter)
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.)
Reacted by Eric Snowericsnowcurrently commented
on Mar 28, 2023 MemberAuthorMore actionsRegarding the freelists in
_asyncio, Kumar and Guido had some thoughts over at #91375 (comment).Elementtree was isolated/ported in gh-92123.
... just noticed_lsprofis also done, AFAICS.rotatingtree.c; sorry 'bout the noise.ericsnowcurrently commented
on Mar 28, 2023 MemberAuthorMore actionsThanks for the updates!
@serhiy-storchaka for _tkinter. I have nothing to do with it.
Reacted by Eric SnowAFAICS,
arrayshould be fine;array_reconstructoris in the module state already.Reacted by Eric SnowI will try to find which modules that I can support for this issue :)
Reacted by Erlend E. Aasland and Eric SnowI will try to find which modules that I can support for this issue :)
Feel free to pick up any of my draft PRs! :)
Reacted by Donghee Na95 remaining items
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.
- added 5 commits that reference this issue
on Sep 2, 2024 - removed3.12only security fixesonly security fixes3.13only security fixesonly security fixes
on Dec 26, 2024 - added a commit that references this issue
on May 8, 2025 _datetimeand_ctypeshave been ported so this is completed now.Reacted by Adam Turner, Sergei Iakhnitskii, Victor Stinner, Erlend E. Aasland and Eric Snow
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.
_ioextension module #101819_decimalextension module #106078The above does not include test modules. They don't need to be ported/isolated (except for a few which already have been).
Modules Analysis
test/example modules
These can be ported/isolated but don't have to be. They are the lowest priority.
Linked PRs
_pickle#102982_decimal#103381_asynciofreelist to module state #104196pyexpat#104506_elementtree#104561_ssl#104725_elementtreemodule importable in sub-interpreters #113434pyexpatmodule importable in sub-interpreters #113555_ctypesmetatypes to heap types #113620_ctypesdata types to heap types #113630_ctypestype hierarchy and features #113727_ctypesdata types to heap types (alt) #113774_ctypes.cstatic types are accessed via global state #113857_zstd(GH-133674) #133695