Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a970e62

Browse files
committed
Merged revisions 88137 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r88137 | antoine.pitrou | 2011-01-21 22:37:32 +0100 (ven., 21 janv. 2011) | 3 lines Fix JSON docs about loads() accepting only str objects, not bytes. ........
1 parent 6107a4e commit a970e62

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

Doc/library/json.rst

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ Basic Usage
118118
file-like object).
119119

120120
If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not
121-
of a basic type (:class:`bytes`, :class:`str`, :class:`int`,
122-
:class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a
123-
:exc:`TypeError`.
121+
of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`,
122+
``None``) will be skipped instead of raising a :exc:`TypeError`.
124123

125124
The :mod:`json` module always produces :class:`str` objects, not
126125
:class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str`
@@ -201,15 +200,11 @@ Basic Usage
201200

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

204-
Deserialize *s* (a :class:`bytes` or :class:`str` instance containing a JSON
205-
document) to a Python object.
206-
207-
If *s* is a :class:`bytes` instance and is encoded with an ASCII based encoding
208-
other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be
209-
specified. Encodings that are not ASCII based (such as UCS-2) are not
210-
allowed and should be decoded to :class:`str` first.
203+
Deserialize *s* (a :class:`str` instance containing a JSON document) to a
204+
Python object.
211205

212-
The other arguments have the same meaning as in :func:`load`.
206+
The other arguments have the same meaning as in :func:`load`, except
207+
*encoding* which is ignored and deprecated.
213208

214209

215210
Encoders and decoders

Lib/json/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
298298
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
299299
kwarg; otherwise ``JSONDecoder`` is used.
300300
301+
The ``encoding`` argument is ignored and deprecated.
302+
301303
"""
302304
if (cls is None and object_hook is None and
303305
parse_int is None and parse_float is None and

0 commit comments

Comments
 (0)