42 TPyReturn::TPyReturn()
53 TPyReturn::TPyReturn( PyObject* pyobject )
65 TPyReturn::TPyReturn(
const TPyReturn& other )
67 Py_INCREF( other.fPyObject );
68 fPyObject = other.fPyObject;
74 TPyReturn& TPyReturn::operator=(
const TPyReturn& other )
76 if (
this != &other ) {
77 Py_INCREF( other.fPyObject );
78 Py_DECREF( fPyObject );
79 fPyObject = other.fPyObject;
88 TPyReturn::~TPyReturn()
90 Py_DECREF( fPyObject );
95 TPyReturn::operator
char*()
const
98 return (
char*)((
const char*)*
this);
104 TPyReturn::operator
const char*()
const
106 if ( fPyObject == Py_None )
109 const char* s = PyROOT_PyUnicode_AsString( fPyObject );
110 if ( PyErr_Occurred() ) {
121 TPyReturn::operator Char_t()
const
123 std::string s =
operator const char*();
133 TPyReturn::operator Long_t()
const
135 Long_t l = PyLong_AsLong( fPyObject );
137 if ( PyErr_Occurred() )
146 TPyReturn::operator ULong_t()
const
148 ULong_t ul = PyLong_AsUnsignedLong( fPyObject );
150 if ( PyErr_Occurred() )
160 TPyReturn::operator Double_t()
const
162 Double_t d = PyFloat_AsDouble( fPyObject );
164 if ( PyErr_Occurred() )
174 TPyReturn::operator
void*()
const
176 if ( fPyObject == Py_None )
179 if ( PyROOT::ObjectProxy_Check( fPyObject ) ) {
180 ((PyROOT::ObjectProxy*)fPyObject)->Release();
181 return ((PyROOT::ObjectProxy*)fPyObject)->GetObject();
189 TPyReturn::operator PyObject*()
const
191 if ( fPyObject == Py_None )
194 Py_INCREF( fPyObject );