MCPcopy Create free account
hub / github.com/boostorg/histogram / setstate

Method setstate

src/python/serialization_suite.hpp:75–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 }
74
75 static void setstate(python::object obj, python::tuple state) {
76 // restore the object's __dict__
77 python::dict d = python::extract<python::dict>(obj.attr("__dict__"));
78 d.update(state[0]);
79
80 // restore the C++ object
81 python::object o = state[1];
82 iostreams::stream<iostreams::array_source> is(PyBytes_AS_STRING(o.ptr()),
83 PyBytes_Size(o.ptr()));
84 archive::text_iarchive ia(is);
85 ia >> python::extract<T&>(obj)();
86 }
87
88 static bool getstate_manages_dict() { return true; }
89};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected