8000 [3.13] gh-87506: Document that json.load*() can raise UnicodeDecodeEr… · python/cpython@0cd6036 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0cd6036

Browse files
miss-islingtonsrinivasreddyerlend-aasland
authored
[3.13] gh-87506: Document that json.load*() can raise UnicodeDecodeError (GH-127355) (#128607)
(cherry picked from commit 15372d0) (cherry picked from commit cdfb8bc) Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com> Co-authored-by: Erlend Aasland <erlend@python.org>
1 parent 984cdb7 commit 0cd6036

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Doc/library/json.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ Basic Usage
324324
:raises JSONDecodeError:
325325
When the data being deserialized is not a valid JSON document.
326326

327+
:raises UnicodeDecodeError:
328+
When the data being deserialized does not contain
329+
UTF-8, UTF-16 or UTF-32 encoded data.
330+
327331
.. versionchanged:: 3.1
328332

329333
* Added the optional *object_pairs_hook* parameter.
@@ -343,15 +347,11 @@ Basic Usage
343347

344348
.. function:: loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
345349

346-
Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray`
350+
Identical to :func:`load`, but instead of a file-like object,
351+
deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray`
347352
instance containing a JSON document) to a Python object using this
348353
:ref:`conversion table <json-to-py-table>`.
349354

350-
The other arguments have the same meaning as in :func:`load`.
351-
352-
If the data being deserialized is not a valid JSON document, a
353-
:exc:`JSONDecodeError` will be raised.
354-
355355
.. versionchanged:: 3.6
356356
*s* can now be of type :class:`bytes` or :class:`bytearray`. The
357357
input encoding should be UTF-8, UTF-16 or UTF-32.

0 commit comments

Comments
 (0)
0