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 Ronan.Lamy
Recipients Ronan.Lamy, docs@python, eric.araujo, eric.snow, lebigot, mherrmann.at, r.david.murray, terry.reedy, vstinner
Date 2012-06-14.16:53:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1339692807.98.0.723832131002.issue12982@psf.upfronthosting.co.za>
In-reply-to
Content
Doing it at the interpreter level is trivial (cf. patch), except for an annoying bug I noticed (see below). Doing it from user code might require some care to avoid disrupting existing import hooks, but AFAICT something like sys.path_hooks.append(FileFinder.path_hook(['.pyo', SourcelessFileLoader, True])) is supposed to work. 

The bug is that -O has currently no effect on sourceless imports: it seems that frozen_importlib actually uses freeze-time __debug__ instead of the current interpreter's.
History
Date User Action Args
2012-06-14 16:53:28Ronan.Lamysetrecipients: + Ronan.Lamy, terry.reedy, vstinner, lebigot, eric.araujo, r.david.murray, docs@python, eric.snow, mherrmann.at
2012-06-14 16:53:27Ronan.Lamysetmessageid: <1339692807.98.0.723832131002.issue12982@psf.upfronthosting.co.za>
2012-06-14 16:53:27Ronan.Lamylinkissue12982 messages
2012-06-14 16:53:27Ronan.Lamycreate