Skip to content

Commit

Permalink
Grammar and spacing tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed May 12, 2024
1 parent ebcd36d commit acf5642
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Doc/library/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Basic Usage
then NaNs and infinities are converted to non-quote-delimited strings
``NaN``, ``Infinity`` and ``-Infinity`` in the JSON output. Note that this
represents an extension of the JSON specification, and that the generated
output may not be accepted as valid JSON by third party JSON parsers.
output may not be accepted as valid JSON by third-party JSON parsers.

If *indent* is a non-negative integer or string, then JSON array elements and
object members will be pretty-printed with that indent level. An indent level
Expand Down Expand Up @@ -216,7 +216,7 @@ Basic Usage

.. versionchanged:: 3.14
Added support for ``allow_nan='as_null'``. Passing any string value
other than ``'as_null'`` for ``allow_nan`` now triggers a
other than ``'as_null'`` for *allow_nan* now triggers a
:warning:`DeprecationWarning`.

.. note::
Expand Down Expand Up @@ -469,7 +469,7 @@ Encoders and Decoders
then NaNs and infinities are converted to non-quote-delimited strings
``NaN``, ``Infinity`` and ``-Infinity`` in the JSON output. Note that this
represents an extension of the JSON specification, and that the generated
output may not be accepted as valid JSON by third party JSON parsers.
output may not be accepted as valid JSON by third-party JSON parsers.

If *sort_keys* is true (default: ``False``), then the output of dictionaries
will be sorted by key; this is useful for regression tests to ensure that
Expand Down
1 change: 1 addition & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,4 @@ Deprecated

Removed
-------

3 changes: 0 additions & 3 deletions Lib/json/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,13 @@ def __init__(self, *, skipkeys=False, ensure_ascii=True,
self.skipkeys = skipkeys
self.ensure_ascii = ensure_ascii
self.check_circular = check_circular

if isinstance(allow_nan, str) and allow_nan != 'as_null':
warnings.warn(
"in the future, allow_nan will no longer accept strings "
"other than 'as_null'. Use a boolean instead.",
DeprecationWarning,
stacklevel=3,
)

self.allow_nan = allow_nan
self.sort_keys = sort_keys
self.indent = indent
Expand Down Expand Up @@ -248,7 +246,6 @@ def floatstr(o, allow_nan=self.allow_nan,

if allow_nan == 'as_null':
return 'null'

elif not allow_nan:
raise ValueError(
"Out of range float values are not JSON compliant: " +
Expand Down

0 comments on commit acf5642

Please sign in to comment.