FairShip
Loading...
Searching...
No Matches
pyFairModule.cxx File Reference
#include "pyFairModule.h"
#include "FairVolume.h"
#include "Python.h"
#include "TObject.h"
Include dependency graph for pyFairModule.cxx:

Go to the source code of this file.

Functions

void call_python_method (PyObject *self, const char *method)

Function Documentation

◆ call_python_method()

void call_python_method ( PyObject * self,
const char * method )

Definition at line 34 of file pyFairModule.cxx.

34 {
35 // check arguments
36 if (nullptr == self || nullptr == method) {
37 throw std::runtime_error("Invalid Python object and method");
38 }
39 // call Python
40 PyObject* r = PyObject_CallMethod(self, const_cast<char*>(method),
41 const_cast<char*>(""));
42 if (nullptr == r) {
43 PyErr_Print();
44 return;
45 }
46 // release used objects
47 Py_XDECREF(r);
48 //
49 return;
50}
_object PyObject
Definition pyFairModule.h:9