This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <>
On Wed, Oct 6, 2021 at 11:38 AM Guido van Rossum <> 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/ 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 (and as a whole?  I don't believe there's any official documentation about the implementation in  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.
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: <>
2021-10-06 18:49:55eric.snowlinkissue45272 messages
2021-10-06 18:49:55eric.snowcreate