mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
[3.12] gh-132021: Add bool type to the list of allowed JSON key types (GH-132048) (#132256)
gh-132021: Add bool type to the list of allowed JSON key types (GH-132048)
(cherry picked from commit 403886c28d)
Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com>
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
This commit is contained in:
parent
3fc57f86b1
commit
aab69a8214
2 changed files with 4 additions and 4 deletions
|
|
@ -475,8 +475,8 @@ Encoders and Decoders
|
|||
(to raise :exc:`TypeError`).
|
||||
|
||||
If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when
|
||||
trying to encode keys that are not :class:`str`, :class:`int`, :class:`float`
|
||||
or ``None``. If *skipkeys* is true, such items are simply skipped.
|
||||
trying to encode keys that are not :class:`str`, :class:`int`, :class:`float`,
|
||||
:class:`bool` or ``None``. If *skipkeys* is true, such items are simply skipped.
|
||||
|
||||
If *ensure_ascii* is true (the default), the output is guaranteed to
|
||||
have all incoming non-ASCII characters escaped. If *ensure_ascii* is
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ def __init__(self, *, skipkeys=False, ensure_ascii=True,
|
|||
"""Constructor for JSONEncoder, with sensible defaults.
|
||||
|
||||
If skipkeys is false, then it is a TypeError to attempt
|
||||
encoding of keys that are not str, int, float or None. If
|
||||
skipkeys is True, such items are simply skipped.
|
||||
encoding of keys that are not str, int, float, bool or None.
|
||||
If skipkeys is True, such items are simply skipped.
|
||||
|
||||
If ensure_ascii is true, the output is guaranteed to be str
|
||||
objects with all incoming non-ASCII characters escaped. If
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue