Skip to content

bpo-11681: Document the -b and -bb options #1562

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
May 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Command line

When invoking Python, you may specify any of these options::

python [-BdEiOQsRStuUvVWxX3?] [-c command | -m module-name | script | - ] [args]
python [-bBdEiOQsRStuUvVWxX3?] [-c command | -m module-name | script | - ] [args]

The most common use case is, of course, a simple invocation of a script::

Expand Down Expand Up @@ -191,6 +191,19 @@ Generic options
Miscellaneous options
~~~~~~~~~~~~~~~~~~~~~

.. cmdoption:: -b

Issue a warning when comparing :class:`unicode` with :class:`bytearray`.
Issue an error when the option is given twice (:option:`!-bb`).

Note that, unlike the corresponding Python 3.x flag, this will **not** emit
warnings for comparisons between :class:`str` and :class:`unicode`.
Instead, the ``str`` instance will be implicitly decoded to ``unicode`` and
Unicode comparison used.

.. versionadded:: 2.6


.. cmdoption:: -B

If given, Python won't try to write ``.pyc`` or ``.pyo`` files on the
Expand Down
2 changes: 2 additions & 0 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ static char *usage_line =
/* Long usage message, split into parts < 512 bytes */
static char *usage_1 = "\
Options and arguments (and corresponding environment variables):\n\
-b : issue warnings about comparing bytearray with unicode\n\
(-bb: issue errors)\n\
-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\
-c cmd : program passed in as string (terminates option list)\n\
-d : debug output from parser; also PYTHONDEBUG=x\n\
Expand Down