SND@LHC Software
Loading...
Searching...
No Matches
pyFairModule.cxx
Go to the documentation of this file.
1#include "Python.h" // Needs to be included first to avoid redefinition of _POSIX_C_SOURCE
2#include "pyFairModule.h"
3#include "TObject.h"
4
5void call_python_method(PyObject* self, const char* method)
6{
7 // check arguments
8 if ( 0 == self || 0 == method ) { throw std::runtime_error("Invalid Python object and method"); }
9 // call Python
10 PyObject* r = PyObject_CallMethod(self, const_cast<char*>(method), const_cast<char*>(""));
11 if ( 0 == r ) { PyErr_Print(); return;}
12 // release used objects
13 Py_XDECREF( r ) ;
14 //
15 return;
16}
void call_python_method(PyObject *self, const char *method)
_object PyObject
Definition pyFairModule.h:2