78 PyObject* result =
self->GetObject() ? Py_True : Py_False;
105 static PyObject* s_expand = PyDict_GetItemString(
106 PyModule_GetDict(
gRootModule ), const_cast< char* >(
"_ObjectProxy__expand__" ) );
113 if ( s_bfClass == self->ObjectIsA() ) {
122 PyErr_Format( PyExc_IOError,
136 PyObject* result = PyTuple_New( 2 );
137 Py_INCREF( s_expand );
138 PyTuple_SET_ITEM( result, 0, s_expand );
139 PyTuple_SET_ITEM( result, 1, res2 );
150 if ( ! PyArg_ParseTuple( args, const_cast< char* >(
"O!O!:__dispatch__" ),
155 PyObject* pymeth = PyObject_GetAttr(
self, mname );
160 PyObject* pydisp = PyObject_GetAttrString( pymeth, const_cast<char*>(
"disp" ) );
167 PyObject* oload = PyObject_CallFunctionObjArgs( pydisp, sigarg, NULL );
185 PyMethodDef op_methods[] = {
186 { (
char*)
"__nonzero__", (PyCFunction)op_nonzero, METH_NOARGS, NULL },
187 { (
char*)
"__bool__", (PyCFunction)op_nonzero, METH_NOARGS, NULL },
188 { (
char*)
"__destruct__", (PyCFunction)op_destruct, METH_NOARGS, NULL },
189 { (
char*)
"__reduce__", (PyCFunction)op_reduce, METH_NOARGS, NULL },
190 { (
char*)
"__dispatch__", (PyCFunction)op_dispatch, METH_VARARGS, (
char*)
"dispatch to selected overload" },
191 { (
char*)
"_get_smart_ptr", (PyCFunction)op_get_smart_ptr, METH_NOARGS, (
char*)
"get associated smart pointer, if any" },
192 { (
char*)NULL, NULL, 0, NULL }
221 if ( op != Py_EQ && op != Py_NE ) {
222 Py_INCREF( Py_NotImplemented );
223 return Py_NotImplemented;
237 if ( ( op == Py_EQ && bIsEq ) || ( op == Py_NE && ! bIsEq ) ) {
238 Py_INCREF( Py_True );
242 Py_INCREF( Py_False );
255 clName.append(
"*" );
257 std::string smartPtrName;
260 smartPtrName = smartPtrType ?
Cppyy::GetFinalName( smartPtrType ) :
"unknown smart pointer";
266 const_cast< char* >(
"GetName" ), const_cast< char* >(
"" ) );
290 clName.c_str(), pyobj->GetObject(), smartPtrName.c_str(), pyobj->fSmartPtr );
293 clName.c_str(), pyobj->GetObject() );
299 #define PYROOT_STUB( name, op, pystring ) \ 300 PyObject* op_##name##_stub( PyObject* left, PyObject* right ) \ 302 if ( ! ObjectProxy_Check( left ) ) { \ 303 if ( ObjectProxy_Check( right ) ) { \ 304 std::swap( left, right ); \ 306 Py_INCREF( Py_NotImplemented ); \ 307 return Py_NotImplemented; \ 311 if ( ! Utility::AddBinaryOperator( \ 312 left, right, #op, "__"#name"__", "__r"#name"__" ) ) { \ 313 Py_INCREF( Py_NotImplemented ); \ 314 return Py_NotImplemented; \ 318 return PyObject_CallMethodObjArgs( left, pystring, right, NULL ); \ 328 PyNumberMethods op_as_number = {
329 (binaryfunc)op_add_stub,
330 (binaryfunc)op_sub_stub,
331 (binaryfunc)op_mul_stub,
332 #
if PY_VERSION_HEX < 0x03000000
333 (binaryfunc)op_div_stub,
348 #if PY_VERSION_HEX < 0x03000000 354 #if PY_VERSION_HEX < 0x03000000 361 #if PY_VERSION_HEX < 0x03000000 371 #if PY_VERSION_HEX >= 0x02020000 373 #if PY_VERSION_HEX < 0x03000000 376 , (binaryfunc)op_div_stub
381 #
if PY_VERSION_HEX >= 0x02050000
384 #
if PY_VERSION_HEX >= 0x03050000
396 (
char*)
"ROOT.ObjectProxy",
399 (destructor)op_dealloc,
408 PyBaseObject_Type.tp_hash,
415 Py_TPFLAGS_BASETYPE |
417 Py_TPFLAGS_CHECKTYPES,
418 (
char*)
"PyROOT object proxy (internal)",
421 (richcmpfunc)op_richcompare,
443 #
if PY_VERSION_HEX >= 0x02030000
446 #
if PY_VERSION_HEX >= 0x02060000
449 #
if PY_VERSION_HEX >= 0x03040000
#define PyBytes_FromString
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
#define PyROOT_PyUnicode_GET_SIZE
Cppyy::TCppType_t fSmartPtrType
R__EXTERN PyObject * gDiv
std::string GetFinalName(TCppType_t type)
R__EXTERN PyObject * gDeref
#define PyVarObject_HEAD_INIT(type, size)
R__EXTERN PyObject * gAdd
#define PYROOT_STUB(name, op, pystring)
#define PyROOT_PyUnicode_FromFormat
R__EXTERN PyObject * gRootModule
#define PyROOT_PyUnicode_Type
#define PyROOT_PyUnicode_AsString
void CallDestructor(TCppType_t type, TCppObject_t self)
PyTypeObject PyRootType_Type
PyTypeObject ObjectProxy_Type
if object ctor succeeded but object should not be used
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass, Bool_t cacheReuse=kTRUE)
Write object to I/O buffer.
virtual void Reset()
Reset buffer object. Resets map and buffer offset.
TCppScope_t GetScope(const std::string &scope_name)
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.
void Deallocate(TCppType_t type, TCppObject_t instance)
R__EXTERN PyObject * gSub
PyObject_HEAD void * fObject
void op_dealloc_nofree(ObjectProxy *)
Destroy the held C++ object, if owned; does not deallocate the proxy.
void Destruct(TCppType_t type, TCppObject_t instance)
PyObject * BindCppObject(Cppyy::TCppObject_t object, Cppyy::TCppType_t klass, Bool_t isRef=kFALSE)
if the object is a null pointer, return a typed one (as needed for overloading)
R__EXTERN PyObject * gMul
Cppyy::TCppType_t ObjectIsA() const
#define PyBytes_FromStringAndSize