Author ncoghlan
Recipients Arfrever, brett.cannon, eric.araujo, eric.smith, eric.snow, lemburg, ncoghlan, pitrou, python-dev
Date 2012-05-07.06:50:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In that case, how about we go with:

1. By default, importlib._bootstrap is never imported. Instead, it is set to be a reference to _frozen_importlib. However, _frozen_importlib does *not* lie about where it came from (and doesn't assume the on-disk source matches the frozen source).

2. We provide two private functions in importlib.__init__: one that replaces all _frozen_importlib references in the import state with importlib._bootstrap references (retrieving the latter from disk first), and one that reverses the process.

Note that the __import__ builtin should be replaced as well, since that will otherwise call in to the frozen version of the module.

This is basically the same as Eric Snow's suggestion, just with most of the nuts and bolts kept within importlib, so that the testing context manager doesn't need to know the details - it can just call the appropriate importlib functions to change the active implementation.
Date User Action Args
2012-05-07 06:50:04ncoghlansetrecipients: + ncoghlan, lemburg, brett.cannon, pitrou, eric.smith, eric.araujo, Arfrever, python-dev, eric.snow
2012-05-07 06:50:04ncoghlansetmessageid: <>
2012-05-07 06:50:03ncoghlanlinkissue14657 messages
2012-05-07 06:50:03ncoghlancreate