-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-17232: Clarify docs for -O and -OO command line options #5839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Modules/main.c
Outdated
-OO : remove doc-strings in addition to the -O optimizations\n\ | ||
-O : remove assert and __debug__-dependent statements; add .opt1 before\n\ | ||
.pyc extension; also PYTHONOPTIMIZE=x\n\ | ||
-OO : do -O changes and also discard docstrings; add .opt2 before\n\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these say “.opt1” etc without a dash, but the other cases have a dash in “.opt-1” etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume oversight on Cheryl's part. I will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume oversight. I checked my cache and '-' is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you for noticing that, Martin, and thank you, Terry, for fixing it. It was an oversight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for moving this along. I will edit and test locally.
Approve was a click mistake.
Modules/main.c
Outdated
-OO : remove doc-strings in addition to the -O optimizations\n\ | ||
-O : remove assert and __debug__-dependent statements; add .opt1 before\n\ | ||
.pyc extension; also PYTHONOPTIMIZE=x\n\ | ||
-OO : do -O changes and also discard docstrings; add .opt2 before\n\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume oversight on Cheryl's part. I will fix.
Doc/using/cmdline.rst
Outdated
Turn on basic optimizations. See also :envvar:`PYTHONOPTIMIZE`. | ||
Remove assert statements and any code conditional on the value of | ||
:const:`__debug__`. Change the filename extension for compiled | ||
(:term:`bytecode`) files to include ``.opt-1`` before the ``.pyc`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change these to read 'Augment the filename for compiled bytecode files by adding .opt-1 before the .pyc extension. ' It does not matter whether one thinks of the addition as a 2nd extension or not, and the change is strictly an addition.
Modules/main.c
Outdated
-OO : remove doc-strings in addition to the -O optimizations\n\ | ||
-O : remove assert and __debug__-dependent statements; add .opt1 before\n\ | ||
.pyc extension; also PYTHONOPTIMIZE=x\n\ | ||
-OO : do -O changes and also discard docstrings; add .opt2 before\n\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume oversight. I checked my cache and '-' is correct.
.TP | ||
.B \-OO | ||
Discard docstrings in addition to the \fB-O\fP optimizations. | ||
Do \fB-O\fP and also discard docstrings; change the filename for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheryl, can you explain the \fB, \fP markup and verify that you somehow tested that it does 'the right thing'? I looked at both the web page and python -h output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I changed the line, I kept that part from the original line and simply add the other text around it. However, it appears the Github does attempt to show what will happen with it. If you click on the 'View' button for this source, Github applies the markup in non-raw mode. This shows up as bolded as does some of the text in the -i
and -I
option that has similar (though not exactly the same) markup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Enough to comfortably merge without personal test.
@terryjreedy: Please replace |
Thanks @csabella for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
…-5839) The 'optimization' is for space in the executable file, not for run time. (cherry picked from commit 186b606) Co-authored-by: Cheryl Sabella <[email protected]>
GH-5867 is a backport of this pull request to the 3.7 branch. |
GH-5868 is a backport of this pull request to the 3.6 branch. |
…-5839) The 'optimization' is for space in the executable file, not for run time. (cherry picked from commit 186b606) Co-authored-by: Cheryl Sabella <[email protected]>
The 'optimization' is for space in the executable file, not for run time. (cherry picked from commit 186b606) Co-authored-by: Cheryl Sabella <[email protected]>
The 'optimization' is for space in the executable file, not for run time. (cherry picked from commit 186b606) Co-authored-by: Cheryl Sabella <[email protected]>
Original patch by Terry Reedy.
https://bugs.python.org/issue17232