mirror of
https://github.com/boostorg/python.git
synced 2026-01-27 19:12:16 +00:00
full integration of (revised) pickle support
[SVN r14557]
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <boost/python/converter/registry.hpp>
|
||||
#include <boost/python/object/class.hpp>
|
||||
#include <boost/python/object/find_instance.hpp>
|
||||
#include <boost/python/object/pickle_support.hpp>
|
||||
#include <boost/python/detail/map_entry.hpp>
|
||||
#include <boost/python/object.hpp>
|
||||
#include <boost/detail/binary_search.hpp>
|
||||
@@ -304,6 +305,16 @@ namespace objects
|
||||
throw_error_already_set();
|
||||
}
|
||||
|
||||
void class_base::enable_pickling(bool getstate_manages_dict)
|
||||
{
|
||||
setattr("__reduce__", make_instance_reduce_function());
|
||||
handle<> one(PyInt_FromLong(1));
|
||||
setattr("__safe_for_unpickling__", one);
|
||||
if (getstate_manages_dict) {
|
||||
setattr("__getstate_manages_dict__", one);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_PYTHON_DECL type_handle registered_class_object(class_id id)
|
||||
{
|
||||
return objects::query_class(id);
|
||||
|
||||
Reference in New Issue
Block a user