Skip to content

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

Merged
merged 2 commits into from
Feb 25, 2018

Conversation

csabella
Copy link
Contributor

@csabella csabella commented Feb 23, 2018

Original patch by Terry Reedy.

https://bugs.python.org/issue17232

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\
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@terryjreedy terryjreedy left a 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\
Copy link
Member

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.

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``
Copy link
Member

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\
Copy link
Member

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
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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 terryjreedy merged commit 186b606 into python:master Feb 25, 2018
@bedevere-bot
Copy link

@terryjreedy: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks @csabella for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 25, 2018
…-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]>
@bedevere-bot
Copy link

GH-5867 is a backport of this pull request to the 3.7 branch.

@bedevere-bot
Copy link

GH-5868 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 25, 2018
…-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]>
miss-islington added a commit that referenced this pull request Feb 25, 2018
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]>
miss-islington added a commit that referenced this pull request Feb 25, 2018
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]>
@csabella csabella deleted the bpo17232 branch February 25, 2018 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants