mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906) (GH-141227)
* Document that ensure_ascii=True forces escaping not only non-ASCII, but also
non-printable characters (the only affected ASCII character is U+007F).
* Ensure that the help output for the json module does not exceed 80
columns (except one long line in an example and generated lines).
* Add more tests.
(cherry picked from commit 7e90bac3cc)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
de00dde9de
commit
24619962e0
6 changed files with 89 additions and 43 deletions
|
|
@ -297,10 +297,10 @@ def __init__(self, *, object_hook=None, parse_float=None,
|
|||
place of the given ``dict``. This can be used to provide custom
|
||||
deserializations (e.g. to support JSON-RPC class hinting).
|
||||
|
||||
``object_pairs_hook``, if specified will be called with the result of
|
||||
every JSON object decoded with an ordered list of pairs. The return
|
||||
value of ``object_pairs_hook`` will be used instead of the ``dict``.
|
||||
This feature can be used to implement custom decoders.
|
||||
``object_pairs_hook``, if specified will be called with the result
|
||||
of every JSON object decoded with an ordered list of pairs. The
|
||||
return value of ``object_pairs_hook`` will be used instead of the
|
||||
``dict``. This feature can be used to implement custom decoders.
|
||||
If ``object_hook`` is also defined, the ``object_pairs_hook`` takes
|
||||
priority.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue