summaryrefslogtreecommitdiffstats
path: root/Doc/using
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-25 22:51:05 (GMT)
committerGitHub <noreply@github.com>2019-06-25 22:51:05 (GMT)
commit22eb689cf3de7972a2789db3ad01a86949508ab7 (patch)
treea1d63fa4cf235008e73f92a18ebef57be54ce4a5 /Doc/using
parente1a63c4f21011a3ae77dff624196561070c83446 (diff)
downloadcpython-22eb689cf3de7972a2789db3ad01a86949508ab7.zip
cpython-22eb689cf3de7972a2789db3ad01a86949508ab7.tar.gz
cpython-22eb689cf3de7972a2789db3ad01a86949508ab7.tar.bz2
bpo-37388: Development mode check encoding and errors (GH-14341)
In development mode and in debug build, encoding and errors arguments are now checked on string encoding and decoding operations. Examples: open(), str.encode() and bytes.decode(). By default, for best performances, the errors argument is only checked at the first encoding/decoding error, and the encoding argument is sometimes ignored for empty strings.
Diffstat (limited to 'Doc/using')
-rw-r--r--Doc/using/cmdline.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index 87af7e8..e11fe31 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -429,6 +429,9 @@ Miscellaneous options
not be more verbose than the default if the code is correct: new warnings
are only emitted when an issue is detected. Effect of the developer mode:
+ * Check *encoding* and *errors* arguments on string encoding and decoding
+ operations. Examples: :func:`open`, :meth:`str.encode` and
+ :meth:`bytes.decode`.
* Add ``default`` warning filter, as :option:`-W` ``default``.
* Install debug hooks on memory allocators: see the
:c:func:`PyMem_SetupDebugHooks` C function.
@@ -469,6 +472,10 @@ Miscellaneous options
The ``-X pycache_prefix`` option. The ``-X dev`` option now logs
``close()`` exceptions in :class:`io.IOBase` destructor.
+ .. versionchanged:: 3.9
+ Using ``-X dev`` option, check *encoding* and *errors* arguments on
+ string encoding and decoding operations.
+
Options you shouldn't use
~~~~~~~~~~~~~~~~~~~~~~~~~