Title: Isolate Stdlib Extension Modules · Issue #103092 · python/cpython · GitHub
Open Graph Title: Isolate Stdlib Extension Modules · Issue #103092 · python/cpython
X Title: Isolate Stdlib Extension Modules · Issue #103092 · python/cpython
Description: 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 ...
Open Graph Description: 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 b...
X Description: 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 b...
Opengraph URL: https://github.com/python/cpython/issues/103092
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Isolate Stdlib Extension Modules","articleBody":"See [PEP 687](https://peps.python.org/pep-0687/).\r\n\r\nCurrently 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.\r\n\r\n(This is part of the effort to finish isolating multiple interpreters from each other. See gh-100227.)\r\n\r\n### High-Level Info\r\n\r\nHow to isolate modules: https://docs.python.org/3/howto/isolating-extensions.html (AKA PEP 630).\r\n\r\nThe full list of modules that need porting can be found with: `...`\r\n\r\nThe full list of remaining (unsupported) global variables is:\r\n\r\n* builtin extensions: https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L308-L335\r\n* non-builtin extensions: https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L338-L551\r\n\r\nA full analysis of the modules may be found at the bottom of this post.\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e(other info)\u003c/summary\u003e\r\n\r\n#### Previous Work\r\n* https://github.com/python/cpython/issues/84258\r\n* _xxsubinterpreters [[issue](https://github.com/python/cpython/issues/99741)] [[PR](https://github.com/python/cpython/pull/99742)]\r\n* _testinternalcapi [[issue](https://github.com/python/cpython/issues/100997)] [[PR](https://github.com/python/cpython/pull/100998)]\r\n* ...\r\n\r\n#### Related Links\r\n\r\n* gh-85283\r\n* https://discuss.python.org/t/a-new-c-api-for-extensions-that-need-runtime-global-locks/20668\r\n* https://discuss.python.org/t/how-to-share-module-state-among-multiple-instances-of-an-extension-module/20663\r\n\r\n\u003c/details\u003e\r\n\r\n\r\n### TODO\r\n\r\nHere 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.\r\n\r\n* builtins (high priority)\r\n * [x] #101819\r\n * [x] **isolate** _collections\r\n * [x] #101520\r\n * [ ] #101509\r\n* essential (higher priority)\r\n * [x] **port** _socket\r\n * [x] **port** readline (leave as is: only available in main interp)\r\n * [x] **isolate** _ssl\r\n * [x] **port** _pickle\r\n * [x] #117398\r\n * [x] **isolate** _asyncio\r\n * [x] #106078 \r\n * [x] **isolate** array\r\n * [x] **port** _ctypes\r\n * [x] #114314\r\n * [x] #117142\r\n * [x] **port** _tkinter (leave as is: only available in main interp)\r\n * [x] #103583\r\n * [x] #101714\r\n * [x] **isolate** _curses_panel (leave as is: only available in main interp)\r\n * [x] **isolate** _elementtree\r\n * [x] **isolate** pyexpat\r\n * [x] **port** winreg (Windows)\r\n * [x] **port** msvcrt (Windows)\r\n* non-essential (lower priority)\r\n * [x] **port** winsound (Windows)\r\n * [x] **isolate** _lsprof\r\n\r\nThe above does not include test modules. They don't need to be ported/isolated (except for a few which already have been).\r\n\r\n---------------\r\n\r\n### Modules Analysis\r\n\r\n| module | builtin | Windows | PEP 594 | issue | PR | ported | # static types | # other global objects | # other globals | \r\n| --- | :---: | :---: | :---: | --- | --- | :---: | ---: | ---: | ---: |\r\n| _asyncio | | | | | | yes | | [2](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L463-L464) | |\r\n| _collections | X | | | (???) | (branch) | yes | [7](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L314-L318) | | |\r\n| _ctypes | | | | | | **\\*\\*NO\\*\\*** | [37](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L344-L380) | [6](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L419-L465) | [4](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L484-L530) |\r\n| _curses | | | | | | **\\*\\*NO\\*\\*** | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L381) | [2](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L420-L442) | [4](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L486-L489) |\r\n| _curses_panel | | | | | | yes | | | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L531) |\r\n| _datetime | | | | gh-71587 | gh-102995 | **\\*\\*NO\\*\\*** | [7](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L382-L388) | [10](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L443-L452) | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L483) |\r\n| _decimal | | | | | | **\\*\\*NO\\*\\*** | [4](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L389-L392) | [10](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L411-L459) | [6](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L490-L495) |\r\n| _elementtree | | | | | | yes | | | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L496) |\r\n| _io | X | | | gh-101819 | gh-101520 | **\\*\\*NO\\*\\*** | [5](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L319-L325) | | |\r\n| _lsprof | | | | | | yes | | | [2](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L549-L550) |\r\n| _multibytecodec | | | | | | yes | | | [23](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L497-L519) |\r\n| _pickle | | | | (???) | (yes) | **\\*\\*NO\\*\\*** | [5](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L382-L388) | | |\r\n| _socket | | | | | | **\\*\\*NO\\*\\*** | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L400) | [2](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L424-L425) | [3](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L523-L551) |\r\n| _ssl | | | | (???) | (branch) | yes | | | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L532) |\r\n| _tkinter | | | | | | **\\*\\*NO\\*\\*** | | [8](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L413-L469) | [9](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L533-L541) |\r\n| _tracemalloc | X | | | gh-101520 | | **\\*\\*NO\\*\\*** | | [6](https://github.com/python/cpython/blob/main/Include/internal/pycore_tracemalloc.h#L86-L104) | [7](https://github.com/python/cpython/blob/main/Include/internal/pycore_tracemalloc.h#L68-L85) |\r\n| array | | | | | | yes | | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L460) | |\r\n| faulthandler | X | | | gh-101509 | | yes | | [3+](https://github.com/python/cpython/blob/main/Include/internal/pycore_faulthandler.h#L39-L79) | [~22+](https://github.com/python/cpython/blob/main/Include/internal/pycore_faulthandler.h#L38-L84) |\r\n| msvcrt | | Y | | | | **\\*\\*NO\\*\\*** | ??? | ??? | ??? |\r\n| pyexpat | | | | | | yes | | | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L480) |\r\n| readline | | | | | | **\\*\\*NO\\*\\*** | | | [9](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L520-L548) |\r\n| winreg | | Y | | | | **\\*\\*NO\\*\\*** | ??? | ??? | ??? |\r\n| winsound | | Y | | | | **\\*\\*NO\\*\\*** | ??? | ??? | ??? |\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003etest/example modules\u003c/summary\u003e\r\n\r\nThese can be ported/isolated but don't have to be. They are the lowest priority.\r\n\r\n| module | issue | PR | ported | # static types | # other global objects | # other globals | \r\n| --- | --- | --- | :---: | ---: | ---: | ---: |\r\n| xxmodule | | | | [3](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L401-L403) | [1](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L427) | |\r\n| xxsubtype | | | | [2](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L404-L405) | | |\r\n| xxlimited_35 | | | | | [2](https://github.com/python/cpython/blob/main/Tools/c-analyzer/cpython/globals-to-fix.tsv#L416-L426) | |\r\n| ... | | | | | | |\r\n| ... | | | | | | |\r\n\r\n\u003c/details\u003e\r\n\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-103093\r\n* gh-102982\r\n* gh-103094\r\n* gh-103108\r\n* gh-103248\r\n* gh-103249\r\n* gh-103250\r\n* gh-103381\r\n* gh-103540\r\n* gh-103612\r\n* gh-103893\r\n* gh-103932\r\n* gh-104020\r\n* gh-104196\r\n* gh-104506\r\n* gh-104561\r\n* gh-104725\r\n* gh-113434\r\n* gh-113555\r\n* gh-113620\r\n* gh-113630\r\n* gh-113727\r\n* gh-113774\r\n* gh-113857\r\n* gh-115130\r\n* gh-115242\r\n* gh-115301\r\n* gh-23091\r\n* gh-133674\n* gh-133695\n\u003c!-- /gh-linked-prs --\u003e","author":{"url":"https://github.com/ericsnowcurrently","@type":"Person","name":"ericsnowcurrently"},"datePublished":"2023-03-28T18:25:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":59},"url":"https://github.com/103092/cpython/issues/103092"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:67fe9814-ba48-b492-139d-a520390e3dfe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CF0C:4F147:C575E:10FDE9:696962EA |
| html-safe-nonce | c152488e78daa3b4fba9ab46c109b6ccfbed88a19eced3bff2f6708f205afec2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjBDOjRGMTQ3OkM1NzVFOjEwRkRFOTo2OTY5NjJFQSIsInZpc2l0b3JfaWQiOiI4MjY1MjI4MjQ1NzgyODQ4MjM0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cf77d42143f28314bed87e817fc3906307f0769f20db16b7d3f6d4997d42d2d8 |
| hovercard-subject-tag | issue:1644462938 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/103092/issue_layout |
| twitter:image | https://opengraph.githubassets.com/029b4e4847885daab986e40909e03154df7b11fb73d6e3a48dd8cc433c032295/python/cpython/issues/103092 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/029b4e4847885daab986e40909e03154df7b11fb73d6e3a48dd8cc433c032295/python/cpython/issues/103092 |
| og:image:alt | 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 b... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ericsnowcurrently |
| hostname | github.com |
| expected-hostname | github.com |
| None | 48487c1ad776a7975b7132d95f4240ff3ae37cd5b8e3cb597102a4edb76738f1 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 669463fcc54773a88c1f5a44eef6b99a5504b9c7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width