| 63 | template <class T> |
| 64 | struct serialization_suite : python::pickle_suite { |
| 65 | static python::tuple getstate(python::object obj) { |
| 66 | PyObject* pobj = nullptr; |
| 67 | iostreams::stream<detail::python_bytes_sink> os(&pobj); |
| 68 | archive::text_oarchive oa(os); |
| 69 | oa << python::extract<const T&>(obj)(); |
| 70 | os.flush(); |
| 71 | return python::make_tuple(obj.attr("__dict__"), |
| 72 | python::object(python::handle<>(pobj))); |
| 73 | } |
| 74 | |
| 75 | static void setstate(python::object obj, python::tuple state) { |
| 76 | // restore the object's __dict__ |
nothing calls this directly
no outgoing calls
no test coverage detected