#ifndef __CINT__ #undef _POSIX_C_SOURCE #include #else // Make cint mappy struct _object; typedef _object PyObject; #endif #include #include "TTree.h" #include "TPython.h" int getobj(PyObject* self, PyObject* arg) { PyObject* pytree = PyObject_GetAttr(self, arg); std::cout << "arg: " << PyString_AsString(arg) << std::endl; // Check that pytree is what we expect it to be, compare to the // __repr__() printed on the python side std::cout << "pytree: " << PyString_AsString(PyObject_Repr(pytree)) << std::endl; // Try and get a direct pointer to the TTree // but this seems to fail TTree* t = (TTree*)TPython::ObjectProxy_AsVoidPtr(pytree); std::cout <<"ttree again: "<< t << std::endl; return 42; }