[Python-checkins] r88138 - in python/branches/release31-maint: Doc/library/json.rst Lib/json/__init__.py

antoine.pitrou python-checkins at python.org
Fri Jan 21 22:39:57 CET 2011


Author: antoine.pitrou
Date: Fri Jan 21 22:39:56 2011
New Revision: 88138

Log:
Merged revisions 88137 via svnmerge from 
svn+ssh://pythondev@svn.python.org/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.
........


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Doc/library/json.rst
   python/branches/release31-maint/Lib/json/__init__.py

Modified: python/branches/release31-maint/Doc/library/json.rst
==============================================================================
--- python/branches/release31-maint/Doc/library/json.rst	(original)
+++ python/branches/release31-maint/Doc/library/json.rst	Fri Jan 21 22:39:56 2011
@@ -118,9 +118,8 @@
    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`
@@ -201,15 +200,11 @@
 
 .. 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

Modified: python/branches/release31-maint/Lib/json/__init__.py
==============================================================================
--- python/branches/release31-maint/Lib/json/__init__.py	(original)
+++ python/branches/release31-maint/Lib/json/__init__.py	Fri Jan 21 22:39:56 2011
@@ -298,6 +298,8 @@
     To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
     kwarg; otherwise ``JSONDecoder`` is used.
 
+    The ``encoding`` argument is ignored and deprecated.
+
     """
     if (cls is None and object_hook is None and
             parse_int is None and parse_float is None and


More information about the Python-checkins mailing list