From 8baa2b7032bb56e21071541263e74a82d223c4bf Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 22 Feb 2001 20:47:36 +0000 Subject: [PATCH] Safer pickle support (explicit auto_pickle parameter) [SVN r9313] --- include/boost/python/class_builder.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/python/class_builder.hpp b/include/boost/python/class_builder.hpp index 7ef843c4..fb696f88 100644 --- a/include/boost/python/class_builder.hpp +++ b/include/boost/python/class_builder.hpp @@ -16,10 +16,14 @@ class class_builder : python_extension_class_converters // Works around MSVC6.x/GCC2.95.2 bug described below { public: - class_builder(module_builder& module, const char* name) + class_builder(module_builder& module, const char* name, + bool auto_pickle = false) : m_class(new detail::extension_class(name)) { module.add(ref(as_object(m_class.get()), ref::increment_count), name); + if (auto_pickle) { + add(ref(BOOST_PYTHON_CONVERSION::to_python(1)), "__auto_pickle__"); + } } ~class_builder()