Author eric.snow
Recipients barry, brett.cannon, corona10, eric.snow, gvanrossum, jaraco, ncoghlan, steve.dower
Date 2021-10-06.18:49:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633546195.5.0.191522982322.issue45272@roundup.psfhosted.org>
In-reply-to
Content
On Wed, Oct 6, 2021 at 11:38 AM Guido van Rossum <report@bugs.python.org> wrote:
> I'm trying to understand the proposed solution, "have _imp.is_frozen() check the module in sys.modules." Does that mean it would do a dict lookup first?

Correct.  We'd look up the module in sys.modules and, if there, check its loader.

> Maybe you should do that in the caller instead? importlib/_bootstrap.py calls it a few times, but I'm not convinced that all call sites can be called with "os.path" -- do you know which path was taken when this failed?

Good point.  The only place where it matters is the FrozenImporter methods that are wrapped with _requires_frozen().  So the fix can go there instead of _imp.is_frozen().

> I worry about the complexity of the importlib bootstrapping mechanism. Grepping through the source for _bootstrap and _bootstrap_external has not given me any understanding of how this works. Do you know if there are docs for this? Or do we just need to ask Brett?

Are you talking about the use of _imp.is_frozen() or do you mean the code in _bootstrap.py (and _bootstrap_external.py) as a whole?  I don't believe there's any official documentation about the implementation in _bootstrap.py.  At best there have been some PyCon talks about how the import system works (but probably not at the level of the implementation) and Brett may have a blog post or two.  Keep in mind that I'm quite familiar with the importlib code, though Brett is definitely the mastermind behind the overall implementation.
History
Date User Action Args
2021-10-06 18:49:55eric.snowsetrecipients: + eric.snow, gvanrossum, barry, brett.cannon, jaraco, ncoghlan, steve.dower, corona10
2021-10-06 18:49:55eric.snowsetmessageid: <1633546195.5.0.191522982322.issue45272@roundup.psfhosted.org>
2021-10-06 18:49:55eric.snowlinkissue45272 messages
2021-10-06 18:49:55eric.snowcreate