From 0931d938b049b4ab190593bd2755d03891d8bfd6 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Mon, 14 Nov 2011 19:32:42 +0200 Subject: [PATCH] doc: The same JSON values must not be encoded in parallel Closes GH-42. --- doc/portability.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/portability.rst b/doc/portability.rst index 0a49e2e..dc6c5eb 100644 --- a/doc/portability.rst +++ b/doc/portability.rst @@ -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. +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 ------ -- 2.1.4