mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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.
This commit is contained in:
parent
e1a63c4f21
commit
22eb689cf3
10 changed files with 315 additions and 6 deletions
|
@ -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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue