[issue8379] if __debug__: has nonobvious behaviour when evaluating .pyo without -O

Brett Cannon report at bugs.python.org
Tue Apr 13 20:51:23 CEST 2010


Brett Cannon <brett at python.org> added the comment:

So technically Python does not know that some bytecode was compiled with optimization flags on; that is simply not carried in the bytecode format. You also cannot rely on file name extensions as the bytecode could have been generated by an interpreter that used .pyo as the file extension for non-optimized bytecode. So you can't really make this an "explicit error" without changing the format of bytecode files.

As for a distribution choice for only shipping bytecode, you should then only ship .pyc files to avoid this issue.

Raymond who (most likely) added the optimization is already on the nosy list so he can decide to disagree with me if he wants, but I am personally still not viewing this as a bug.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8379>
_______________________________________


More information about the Python-bugs-list mailing list