{{ message }}
gh-117953: Refactor Import Machinery Code for Extension Modules - #118116
Closed
ericsnowcurrently wants to merge 40 commits into
Closed
gh-117953: Refactor Import Machinery Code for Extension Modules#118116ericsnowcurrently wants to merge 40 commits into
ericsnowcurrently wants to merge 40 commits into
Conversation
Member
Author
Member
It's giant! :) Do you see some parts that would be an improvement on their own, which could be split out and reviewed separately? Perhaps some mechanical stuff like replacing If you don't, this patch is certainly reviewable -- over a few days. I sent a similar giant patch recently, where I couldn't figure out how to break it down further. |
This was referenced Apr 22, 2024
Member
Author
ericsnowcurrently
added a commit
that referenced
this pull request
Apr 23, 2024
) This is a collection of very basic cleanups I've pulled out of gh-118116. It is mostly renaming variables and moving a couple bits of code in functionally equivalent ways.
This was referenced Apr 23, 2024
This was referenced Apr 24, 2024
ericsnowcurrently
added a commit
that referenced
this pull request
Apr 24, 2024
These are cleanups I've pulled out of gh-118116. Mostly, this change moves code around to align with some future changes and to improve clarity a little. There is one very small change in behavior: we now add the module to the per-interpreter caches after updating the global state, rather than before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is a large change that involves refactoring the code that loads extension modules. The objective is partly to improve the clarity of the code, but mostly it's so that I can execute a subset of the constituent operations in a subsequent PR.
The changes include:
While this aligns with the sort of thing I've wanted to do for a long time, the main motivation at the moment is to drastically reduce the likelihood of problems from loading a single-phase init extension module in an isolated subinterpreter. Nearly all the changes here come from what I found I needed for a (relatively) simple solution to the isolation problem. Consequently, much of the refactoring follows the natural divisions in the flow of operations when loading an extension module.
For the sake of reducing the burden of code review for such a large change, I have purposefully avoided changing any behavior in this PR, regardless of how benign it might seem. That said, if it's still too much I'm okay with splitting this up.
For context, this is the first of 3 branches in a chain. Here are the other two, in order: