[Python-checkins] cpython (2.7): #4783: document that is not possible to use json.dump twice on the same stream.

ezio.melotti python-checkins at python.org
Fri Apr 15 06:40:55 CEST 2011


http://hg.python.org/cpython/rev/8dbf072556b9
changeset:   69355:8dbf072556b9
branch:      2.7
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Fri Apr 15 07:37:00 2011 +0300
summary:
  #4783: document that is not possible to use json.dump twice on the same stream.

files:
  Doc/library/json.rst |  5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Doc/library/json.rst b/Doc/library/json.rst
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -156,6 +156,11 @@
    :meth:`default` method to serialize additional types), specify it with the
    *cls* kwarg; otherwise :class:`JSONEncoder` is used.
 
+   .. note::
+
+      Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol so
+      trying to serialize more objects with repeated calls to :func:`dump` and
+      the same *fp* will result in an invalid JSON file.
 
 .. function:: dumps(obj[, skipkeys[, ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, encoding[, default[, **kw]]]]]]]]]])
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list