[docs] [issue12982] Document that importing .pyo files needs python -O

Ronan Lamy report at bugs.python.org
Thu Jun 14 18:53:28 CEST 2012


Ronan Lamy <ronan.lamy at 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 <report at bugs.python.org>
<http://bugs.python.org/issue12982>
_______________________________________


More information about the docs mailing list