Skip to content

bpo-17232: Clarify docs for -O and -OO command line options#5839

Merged
terryjreedy merged 2 commits into
python:masterfrom
csabella:bpo17232
Feb 25, 2018
Merged

bpo-17232: Clarify docs for -O and -OO command line options#5839
terryjreedy merged 2 commits into
python:masterfrom
csabella:bpo17232

Conversation

@csabella

@csabella csabella commented Feb 23, 2018

Copy link
Copy Markdown
Contributor

Original patch by Terry Reedy.

https://bugs.python.org/issue17232

Comment thread 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

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.

Comment thread 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
Copy Markdown
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.

Comment thread 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``

Copy link
Copy Markdown
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.

Comment thread 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
Copy Markdown
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.

Comment thread Misc/python.man
.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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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

@miss-islington

Copy link
Copy Markdown
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 <cheryl.sabella@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

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

@bedevere-bot

Copy link
Copy Markdown

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 <cheryl.sabella@gmail.com>
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 <cheryl.sabella@gmail.com>
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 <cheryl.sabella@gmail.com>
@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