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 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 <1336373404.51.0.688970379347.issue14657@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
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: <1336373404.51.0.688970379347.issue14657@psf.upfronthosting.co.za>
2012-05-07 06:50:03ncoghlanlinkissue14657 messages
2012-05-07 06:50:03ncoghlancreate