diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-21 21:37:32 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-01-21 21:37:32 (GMT) |
commit | 00d650baaa72477d6904cce9667ca18e916405e6 (patch) | |
tree | b6931e71c154371ee8f7a60e53f3876983ab39b0 /Doc/library/json.rst | |
parent | 2e042d3dc26d852f9ad89edb2a48d40c376ba968 (diff) | |
download | cpython-00d650baaa72477d6904cce9667ca18e916405e6.zip cpython-00d650baaa72477d6904cce9667ca18e916405e6.tar.gz cpython-00d650baaa72477d6904cce9667ca18e916405e6.tar.bz2 |
Fix JSON docs about loads() accepting only str objects, not bytes.
Diffstat (limited to 'Doc/library/json.rst')
-rw-r--r-- | Doc/library/json.rst | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst index b0703a4..0ba22d1 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -118,9 +118,8 @@ Basic Usage file-like object). If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not - of a basic type (:class:`bytes`, :class:`str`, :class:`int`, - :class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a - :exc:`TypeError`. + of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, + ``None``) will be skipped instead of raising a :exc:`TypeError`. The :mod:`json` module always produces :class:`str` objects, not :class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` @@ -203,15 +202,11 @@ Basic Usage .. 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:`bytes` or :class:`str` instance containing a JSON - document) to a Python object. - - If *s* is a :class:`bytes` instance and is encoded with an ASCII based encoding - other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be - specified. Encodings that are not ASCII based (such as UCS-2) are not - allowed and should be decoded to :class:`str` first. + Deserialize *s* (a :class:`str` instance containing a JSON document) to a + Python object. - The other arguments have the same meaning as in :func:`load`. + The other arguments have the same meaning as in :func:`load`, except + *encoding* which is ignored and deprecated. Encoders and decoders |