Ronan Lamy <ronan.l...@gmail.com> added the comment:

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.

----------
keywords: +patch
Added file: http://bugs.python.org/file26008/issue12982.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12982>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to