summaryrefslogtreecommitdiffstats
path: root/Lib/json/__init__.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-02 20:16:18 (GMT)
committerGeorg Brandl <georg@python.org>2010-08-02 20:16:18 (GMT)
commitc8284cfc572fbaadb1f436aac4480a3f386bba54 (patch)
treea0367e9df40275fc72d7fb6045d8d2b995f368d4 /Lib/json/__init__.py
parent8477f82c3e864cf0e1970b37afde82576cce8d06 (diff)
downloadcpython-c8284cfc572fbaadb1f436aac4480a3f386bba54.zip
cpython-c8284cfc572fbaadb1f436aac4480a3f386bba54.tar.gz
cpython-c8284cfc572fbaadb1f436aac4480a3f386bba54.tar.bz2
#9087: update json docstrings -- unicode and long do not exist anymore.
Diffstat (limited to 'Lib/json/__init__.py')
-rw-r--r--Lib/json/__init__.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py
index 6a18518..5d8cb19 100644
--- a/Lib/json/__init__.py
+++ b/Lib/json/__init__.py
@@ -125,14 +125,12 @@ def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
``.write()``-supporting file-like object).
If ``skipkeys`` is true then ``dict`` keys that are not basic types
- (``str``, ``unicode``, ``int``, ``float``, ``bool``, ``None``) will be
- skipped instead of raising a ``TypeError``.
+ (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped
+ instead of raising a ``TypeError``.
- If ``ensure_ascii`` is false, then the some chunks written to ``fp``
- may be ``unicode`` instances, subject to normal Python ``str`` to
- ``unicode`` coercion rules. Unless ``fp.write()`` explicitly
- understands ``unicode`` (as in ``codecs.getwriter()``) this is likely
- to cause an error.
+ If ``ensure_ascii`` is false, then the strings written to ``fp`` can
+ contain non-ASCII characters if they appear in strings contained in
+ ``obj``. Otherwise, all such characters are escaped in JSON strings.
If ``check_circular`` is false, then the circular reference check
for container types will be skipped and a circular reference will
@@ -185,12 +183,12 @@ def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
"""Serialize ``obj`` to a JSON formatted ``str``.
If ``skipkeys`` is false then ``dict`` keys that are not basic types
- (``str``, ``unicode``, ``int``, ``float``, ``bool``, ``None``) will be
- skipped instead of raising a ``TypeError``.
+ (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped
+ instead of raising a ``TypeError``.
- If ``ensure_ascii`` is false, then the return value will be a
- ``unicode`` instance subject to normal Python ``str`` to ``unicode``
- coercion rules instead of being escaped to an ASCII ``str``.
+ If ``ensure_ascii`` is false, then the return value can contain non-ASCII
+ characters if they appear in strings contained in ``obj``. Otherwise, all
+ such characters are escaped in JSON strings.
If ``check_circular`` is false, then the circular reference check
for container types will be skipped and a circular reference will