Install the pickling of ObjectProxy's functionality.
Install the pickling of CPPInstance's functionality.
113{
114 Py_INCREF( libpyroot_pymodule );
115 PyTypeObject* pytype = reinterpret_cast<PyTypeObject*>(cppinstance_pytype);
116
117
118 static PyMethodDef s_pdefExp = { (char*)"_ObjectProxy__expand__",
120
121 PyObject* pymname = PyUnicode_FromString( PyModule_GetName( libpyroot_pymodule ) );
122 gExpand = PyCFunction_NewEx( &s_pdefExp, NULL, pymname );
123 Py_DECREF( pymname );
124 Bool_t isOk = PyObject_SetAttrString( libpyroot_pymodule, s_pdefExp.ml_name,
gExpand ) == 0;
126
127 if ( ! isOk ) {
128 Py_DECREF( libpyroot_pymodule );
129 PyErr_SetString( PyExc_TypeError, "could not add expand function to libPyROOT" );
130 return;
131 }
132
133 static PyMethodDef s_pdefRed = { (char*)"__reduce__",
135
137 isOk = PyDict_SetItemString( pytype->tp_dict, s_pdefRed.ml_name, descr) == 0;
138 Py_DECREF( descr );
139 if ( ! isOk ) {
140 Py_DECREF( libpyroot_pymodule );
141 PyErr_SetString( PyExc_TypeError, "could not add __reduce__ function to CPPInstance" );
142 return;
143 }
144
145 Py_DECREF( libpyroot_pymodule );
146}
static PyObject * gExpand
PyObject * CPPInstanceReduce(PyObject *self, PyObject *)
PyROOT object proxy pickle support.
PyObject * CPPInstanceExpand(PyObject *, PyObject *args)
Helper for (un)pickling of CPPInstance's.