Skip to content

Commit f38ace6

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 4705ea3 commit f38ace6

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
@@ -262,6 +262,10 @@ Basic Usage
262262
.. versionchanged:: 3.6
263263
All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`.
264264

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

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

0 commit comments

Comments
 (0)