doc: The same JSON values must not be encoded in parallel
authorPetri Lehtinen <petri@digip.org>
Mon, 14 Nov 2011 17:32:42 +0000 (19:32 +0200)
committerPetri Lehtinen <petri@digip.org>
Mon, 14 Nov 2011 19:01:34 +0000 (21:01 +0200)
Closes GH-42.

doc/portability.rst

index 0a49e2e..dc6c5eb 100644 (file)
@@ -20,6 +20,16 @@ such values, as containers manage the reference count of their
 contained values. Bugs involving concurrent incrementing or
 decrementing of deference counts may be hard to track.
 
 contained values. Bugs involving concurrent incrementing or
 decrementing of deference counts may be hard to track.
 
+The encoding functions (:func:`json_dumps()` and friends) track
+reference loops by modifying the internal state of objects and arrays.
+For this reason, encoding functions must not be run on the same JSON
+values in two separate threads at the same time. As already noted
+above, be especially careful if two arrays or objects share their
+contained values with another array or object.
+
+If you want to make sure that two JSON value hierarchies do not
+contain shared values, use :func:`json_deep_copy()` to make copies.
+
 Locale
 ------
 
 Locale
 ------