15#include "../../cppyy/CPyCppyy/src/CPyCppyy.h"
16#include "../../cppyy/CPyCppyy/src/CPPInstance.h"
17#include "../../cppyy/CPyCppyy/src/CustomPyTypes.h"
47 if (strcmp(clname,
"TBufferFile") == 0) {
77 if (selfClass == s_bfClass) {
81 if (className.find(
"__cppyy_internal::Dispatcher") == 0) {
82 PyErr_Format(PyExc_IOError,
83 "generic streaming of Python objects whose class derives from a C++ class is not supported. "
84 "Please refer to the Python pickle documentation for instructions on how to define "
85 "a custom __reduce__ method for the derived Python class");
94 PyErr_Format(PyExc_IOError,
"could not stream object of type %s",
109 PyTuple_SET_ITEM(
result, 0, s_expand);
110 PyTuple_SET_ITEM(
result, 1, res2);
125 PyObject *pyclass = PyTuple_GetItem(args, 0);
127 const char *
attr =
"__reduce__";
129 PyMethodDef *pdef =
new PyMethodDef();
130 pdef->ml_name =
attr;
132 pdef->ml_flags = METH_NOARGS;
133 pdef->ml_doc =
nullptr;
135 PyObject *func = PyCFunction_New(pdef,
nullptr);
142 PyObject_GenericSetAttr(pyclass, PyUnicode_FromString(
attr), method);
PyObject * op_reduce(PyObject *self, PyObject *)
PyROOT object proxy pickle support Turn the object proxy instance into a character stream and return ...
#define PyBytes_AS_STRING
#define PyBytes_FromString
#define PyBytes_FromStringAndSize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
void WriteFastArray(const Bool_t *b, Long64_t n) override
Write array of n bools into the I/O buffer.
void * ReadObjectAny(const TClass *cast) override
Read object from I/O buffer.
void Reset() override
Reset buffer object. Resets map and buffer offset.
Int_t WriteObjectAny(const void *obj, const TClass *ptrClass, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
PyObject * CustomInstanceMethod_New(PyObject *func, PyObject *self, PyObject *pyclass)
CPYCPPYY_EXTERN PyObject * Instance_FromVoidPtr(void *addr, const std::string &classname, bool python_owns=false)
CPYCPPYY_EXTERN void * Instance_AsVoidPtr(PyObject *pyobject)
RPY_EXPORTED std::string GetScopedFinalName(TCppType_t type)
RPY_EXPORTED TCppScope_t GetScope(const std::string &scope_name)
PyObject * AddCPPInstancePickling(PyObject *self, PyObject *args)
Set reduce attribute for CPPInstance objects.
PyObject * CPPInstanceExpand(PyObject *self, PyObject *args)
Deserialize pickled objects.