[issue9583] PYTHONOPTIMIZE = 0 is not honored
Terry J. Reedy
report at bugs.python.org
Tue Sep 21 01:39:48 CEST 2010
Terry J. Reedy <tjreedy at udel.edu> added the comment:
I am following the suggestion in the last sentence of the original post and turning this into a doc issue. I believe it is standard that command-line switches override environmental variables when there is a conflict, but 'Using Python', section 1.2. 'Environment variables' could gain a sentence that says so, or whatever the case is. If I am correct, "These environment variables influence Python’s behavior." could be followed by "They are processed *before* the command-line switches other than -E."
As I read the doc, PYTHONOPTIMIZE = 0, does not seem to mean to the interpreter what you expect it to. "PYTHONOPTIMIZE If this is set to a non-empty string it is equivalent to specifying the -O option. If set to an integer, it is equivalent to specifying -O multiple times." (which is to say, equivalent to -OO.) But the doc could be misleading. You can check the source if you wish.
In general there are lots of switches to alter defaults and turn things on but none to restore defaults and turn things off. The one exception is "-E Ignore all PYTHON* environment variables, e.g. PYTHONPATH and PYTHONHOME, that might be set." The obvious intent is to start fresh and only specify what one wants. I do not think one idiosyncratic wrapper is sufficient reason to add one or more other off switches. There are already about 20 options. If you do not want something turned on, do not turn it on.
stage: -> needs patch
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list