[docs] [issue12982] Document that importing .pyo files needs python -O
R. David Murray
report at bugs.python.org
Thu Jun 14 15:20:05 CEST 2012
R. David Murray <rdmurray at bitdance.com> added the comment:
Because:
1) The __debug__ flag is defined to be process-global. If you test it in one module, your code should be able to assume that it has the same value in all other modules
2) python-dev does not support running .pyo code without -O turned on. In the future it might be the case that -O would actually change the behavior of the running python interpreter such that .pyo code would fail of -O was not on.
So, you can do the rename or importer trick if you want, and it will work right now as long as your program does not depend on __debug__ being globally consistent (which would be the case for almost all programs), but we do not guarantee it will continue to work in future versions of Python.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12982>
_______________________________________
More information about the docs
mailing list