Skip to content

Commit 21f2553

Browse files
bpo-17909: Document that json.load can accept a binary IO (GH-7366)
(cherry picked from commit bb6366b) Co-authored-by: Anthony Sottile <[email protected]>
1 parent 97fe1b4 commit 21f2553

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Doc/library/json.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ Basic Usage
215215

216216
.. function:: load(fp, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
217217

218-
Deserialize *fp* (a ``.read()``-supporting :term:`file-like object`
219-
containing a JSON document) to a Python object using this :ref:`conversion
220-
table <json-to-py-table>`.
218+
Deserialize *fp* (a ``.read()``-supporting :term:`text file` or
219+
:term:`binary file` containing a JSON document) to a Python object using
220+
this :ref:`conversion table <json-to-py-table>`.
221221

222222
*object_hook* is an optional function that will be called with the result of
223223
any object literal decoded (a :class:`dict`). The return value of
@@ -264,6 +264,10 @@ Basic Usage
264264
.. versionchanged:: 3.6
265265
All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`.
266266

267+
.. versionchanged:: 3.6
268+
*fp* can now be a :term:`binary file`. The input encoding should be
269+
UTF-8, UTF-16 or UTF-32.
270+
267271
.. function:: loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
268272

269273
Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray`

0 commit comments

Comments
 (0)