Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-17909: Document that json.load can accept a binary IO #7366

Merged
merged 1 commit into from
Jun 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Doc/library/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ Basic Usage

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

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

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

.. versionchanged:: 3.6
*fp* can now be a :term:`binary file`. The input encoding should be
UTF-8, UTF-16 or UTF-32.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO the feature should also be documented in the body of the function documentation, not also in this versionchanged note.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, added!


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

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