PEP 597: Use longer option name (#1821)

This commit is contained in:
Inada Naoki 2021-02-19 17:40:27 +09:00 committed by GitHub
parent aeab09a58f
commit 233ecaddab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -17,9 +17,9 @@ Add a new warning category ``EncodingWarning``. It is emitted when
``encoding`` option is omitted and the default encoding is a locale ``encoding`` option is omitted and the default encoding is a locale
encoding. encoding.
The warning is disabled by default. New ``-X warn_encoding`` The warning is disabled by default. New ``-X warn_default_encoding``
command-line option and ``PYTHONWARNENCODING`` environment variable command-line option and ``PYTHONWARNDEFAULTENCODING`` environment
are used to enable the warnings. variable are used to enable the warnings.
``encoding="locale"`` option is added too. It is used to specify ``encoding="locale"`` option is added too. It is used to specify
locale encoding explicitly. locale encoding explicitly.
@ -109,9 +109,9 @@ omitted and the default encoding is locale-specific.
Options to enable the warning Options to enable the warning
------------------------------ ------------------------------
``-X warn_encoding`` option and the ``PYTHONWARNENCODING`` ``-X warn_default_encoding`` option and the
environment variable are added. They are used to enable the ``PYTHONWARNDEFAULTENCODING`` environment variable are added. They
``EncodingWarning``. are used to enable the ``EncodingWarning``.
``sys.flags.encoding_warning`` is also added. The flag represents ``sys.flags.encoding_warning`` is also added. The flag represents
``EncodingWarning`` is enabled. ``EncodingWarning`` is enabled.
@ -255,8 +255,8 @@ Using ``open(filename)`` to read text files encoded in UTF-8 is a
common mistake. It may not work on Windows because UTF-8 is not the common mistake. It may not work on Windows because UTF-8 is not the
default encoding. default encoding.
You can use ``-X warn_encoding`` or ``PYTHONWARNENCODING=1`` to find You can use ``-X warn_default_encoding`` or
this type of mistake. ``PYTHONWARNDEFAULTENCODING=1`` to find this type of mistake.
Omitting ``encoding`` option is not a bug when opening text files Omitting ``encoding`` option is not a bug when opening text files
encoded in locale encoding. But ``encoding="locale"`` is recommended encoded in locale encoding. But ``encoding="locale"`` is recommended