diff --git a/doc/v2/pickle.html b/doc/v2/pickle.html
index ac28798a..0e40ae1b 100644
--- a/doc/v2/pickle.html
+++ b/doc/v2/pickle.html
@@ -173,7 +173,7 @@ provide pickle support.
For simplicity, the __dict__ is not included in the result
of __getstate__. This is not generally recommended, but a
valid approach if it is anticipated that the object's
- __dict__ will always be empty. Note that the safet guard
+ __dict__ will always be empty. Note that the safety guard
described below will catch the cases where this assumption is violated.
@@ -188,24 +188,15 @@ provide pickle support.
Pitfall and Safety Guard
-In Boost.Python extension modules with many extension classes,
-providing complete pickle support for all classes would be a
-significant overhead. In general complete pickle support should only be
-implemented for extension classes that will eventually be pickled.
-However, the author of a Boost.Python extension module might not
-anticipate correctly which classes need support for pickle.
-Unfortunately, the pickle protocol described above has an important
-pitfall that the end user of a Boost.Python extension module might not
-be aware of:
-
-
--
+The pickle protocol described above has an important pitfall that the
+end user of a Boost.Python extension module might not be aware of:
+
__getstate__ is defined and the instance's __dict__
is not empty.
-
-
+
The author of a Boost.Python extension class might provide a
__getstate__ method without considering the possibilities
that:
@@ -239,9 +230,9 @@ is not empty.
To resolve this problem, it should first be established that the
__getstate__ and __setstate__ methods manage the
instances's __dict__ correctly. Note that this can be done
- both at the C++ and the Python level. Finally, the safety guard
+ either at the C++ or the Python level. Finally, the safety guard
should intentionally be overridden. E.g. in C++ (from
- pickle3.cpp:
+ pickle3.cpp):
struct world_pickle_suite : boost::python::pickle_suite
@@ -263,12 +254,19 @@ is not empty.
def __setstate__(self, state):
# your code here
-
Practical Advice
+-
+ In Boost.Python extension modules with many extension classes,
+ providing complete pickle support for all classes would be a
+ significant overhead. In general complete pickle support should
+ only be implemented for extension classes that will eventually
+ be pickled.
+
+
-
Avoid using __getstate__ if the instance can also be
reconstructed by way of __getinitargs__. This automatically