File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed
NEWS.d/next/Documentation Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -246,12 +246,23 @@ Miscellaneous options
246246
247247.. cmdoption :: -O
248248
249- Turn on basic optimizations. See also :envvar: `PYTHONOPTIMIZE `.
249+ Remove assert statements and any code conditional on the value of
250+ :const: `__debug__ `. Augment the filename for compiled
251+ (:term: `bytecode `) files by adding ``.opt-1 `` before the ``.pyc ``
252+ extension (see :pep: `488 `). See also :envvar: `PYTHONOPTIMIZE `.
253+
254+ .. versionchanged :: 3.5
255+ Modify ``.pyc `` filenames according to :pep: `488 `.
250256
251257
252258.. cmdoption :: -OO
253259
254- Discard docstrings in addition to the :option: `-O ` optimizations.
260+ Do :option: `-O ` and also discard docstrings. Augment the filename
261+ for compiled (:term: `bytecode `) files by adding ``.opt-2 `` before the
262+ ``.pyc `` extension (see :pep: `488 `).
263+
264+ .. versionchanged :: 3.5
265+ Modify ``.pyc `` filenames according to :pep: `488 `.
255266
256267
257268.. cmdoption :: -q
Original file line number Diff line number Diff line change 1+ Clarify docs for -O and -OO. Patch by Terry Reedy.
Original file line number Diff line number Diff line change @@ -156,10 +156,13 @@ for the named module and runs the corresponding
156156file as a script.
157157.TP
158158.B \- O
159- Turn on basic optimizations. Given twice, causes docstrings to be discarded.
159+ Remove assert statements and any code conditional on the value of
160+ __debug__; augment the filename for compiled (bytecode) files by
161+ adding .opt-1 before the .pyc extension.
160162.TP
161163.B \- OO
162- Discard docstrings in addition to the \fB -O \fP optimizations.
164+ Do \fB -O \fP and also discard docstrings; change the filename for
165+ compiled (bytecode) files by adding .opt-2 before the .pyc extension.
163166.TP
164167.B \- q
165168Do not print the version and copyright messages. These messages are
Original file line number Diff line number Diff line change @@ -64,8 +64,10 @@ static const char usage_2[] = "\
6464 if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\
6565-I : isolate Python from the user's environment (implies -E and -s)\n\
6666-m mod : run library module as a script (terminates option list)\n\
67- -O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\
68- -OO : remove doc-strings in addition to the -O optimizations\n\
67+ -O : remove assert and __debug__-dependent statements; add .opt-1 before\n\
68+ .pyc extension; also PYTHONOPTIMIZE=x\n\
69+ -OO : do -O changes and also discard docstrings; add .opt-2 before\n\
70+ .pyc extension\n\
6971-q : don't print version and copyright messages on interactive startup\n\
7072-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\
7173-S : don't imply 'import site' on initialization\n\
You can’t perform that action at this time.
0 commit comments