48 PyGILState_STATE m_GILState;
50 PyGILRAII() : m_GILState(PyGILState_Ensure()) { }
51 ~PyGILRAII() { PyGILState_Release(m_GILState); }
118TPyReturn::operator
char *()
const
123 return (
char *)((
const char *)*
this);
129TPyReturn::operator
const char *()
const
133 if (fPyObject == Py_None)
136 const char *s = PyUnicode_AsUTF8AndSize(fPyObject,
nullptr);
137 if (PyErr_Occurred()) {
152 std::string s =
operator const char *();
166 Long_t l = PyLong_AsLong(fPyObject);
168 if (PyErr_Occurred())
181 ULong_t ul = PyLong_AsUnsignedLong(fPyObject);
183 if (PyErr_Occurred())
196 Double_t d = PyFloat_AsDouble(fPyObject);
198 if (PyErr_Occurred())
208TPyReturn::operator
void *()
const
212 if (fPyObject == Py_None)
229 if (fPyObject == Py_None)
232 Py_IncRef(fPyObject);
char Char_t
Character 1 byte (char)
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
double Double_t
Double 8 bytes.
Morphing return type from evaluating python expressions.
TPyReturn & operator=(const TPyReturn &)
Assignment operator. Applies python object reference counting.
virtual ~TPyReturn()
Destructor. Reference counting for the held python object is in effect.
PyObject * fPyObject
! actual python object
CPYRT_EXTERN bool Instance_Check(PyObject *pyobject)
CPYRT_EXTERN void * Instance_AsVoidPtr(PyObject *pyobject)
CPYRT_EXTERN void Instance_SetCppOwns(PyObject *pyobject)