24#include "RConfigure.h"
78 other.fObject =
nullptr;
84 other.fObject =
nullptr;
93 PyArg_ParseTuple(args,
"O:PyObjRefCounterAsStdAny", &
object);
105bool WarningHandler(
const char *location,
const char *msg)
107 PyGILState_STATE state = PyGILState_Ensure();
110 bool handled = !PyErr_Occurred();
114 PyErr_WarnExplicit(
nullptr, msg, location, 0,
"ROOT",
nullptr);
116 PyGILState_Release(state);
120int (*gPreviousInputHook)() =
nullptr;
124int GUIEventInputHook()
126 PyGILState_STATE state = PyGILState_Ensure();
130 PyGILState_Release(state);
132 return gPreviousInputHook ? gPreviousInputHook() : 0;
146 if (PyOS_InputHook != &GUIEventInputHook) {
147 gPreviousInputHook = PyOS_InputHook;
148 PyOS_InputHook = &GUIEventInputHook;
158 "Add a custom pickling mechanism for Cppyy Python proxy objects"},
160 "Add pretty printing pythonization"},
161 {
"InstallWarningHandler", (PyCFunction)InstallWarningHandler, METH_NOARGS,
162 "Turn ROOT warnings into Python warnings"},
163 {
"InstallGUIEventInputHook", (PyCFunction)InstallGUIEventInputHook, METH_NOARGS,
164 "Install an input hook to process GUI events"},
166 "Deserialize a pickled object"},
167 {
"JupyROOTExecutor", (PyCFunction)
JupyROOTExecutor, METH_VARARGS,
"Create JupyROOTExecutor"},
168 {
"JupyROOTDeclarer", (PyCFunction)
JupyROOTDeclarer, METH_VARARGS,
"Create JupyROOTDeclarer"},
170 "Clear JupyROOTExecutorHandler"},
172 "Create JupyROOTExecutorHandler"},
174 "Poll JupyROOTExecutorHandler"},
176 "End capture JupyROOTExecutorHandler"},
178 "Init capture JupyROOTExecutorHandler"},
180 "Get stdout JupyROOTExecutorHandler"},
182 "Get stderr JupyROOTExecutorHandler"},
184 "Destruct JupyROOTExecutorHandler"},
186 "Wrap a reference count to any Python object in a std::any for resource management in C++"},
187 {NULL, NULL, 0, NULL}};
193#define GETSTATE(m) ((struct module_state *)PyModule_GetState(m))
207static struct PyModuleDef
moduledef = {PyModuleDef_HEAD_INIT,
"libROOTPythonizations", NULL,
218 gRootModule = PyModule_Create(&
moduledef);
PyObject * JupyROOTExecutorHandler_Ctor(PyObject *, PyObject *)
PyObject * JupyROOTDeclarer(PyObject *, PyObject *args)
PyObject * JupyROOTExecutorHandler_GetStdout(PyObject *, PyObject *)
PyObject * JupyROOTExecutor(PyObject *, PyObject *args)
PyObject * JupyROOTExecutorHandler_EndCapture(PyObject *, PyObject *)
PyObject * JupyROOTExecutorHandler_Poll(PyObject *, PyObject *)
PyObject * JupyROOTExecutorHandler_Clear(PyObject *, PyObject *)
PyObject * JupyROOTExecutorHandler_GetStderr(PyObject *, PyObject *)
PyObject * JupyROOTExecutorHandler_InitCapture(PyObject *, PyObject *)
PyObject * JupyROOTExecutorHandler_Dtor(PyObject *, PyObject *)
static struct PyModuleDef moduledef
PyObject * PyInit_libROOTPythonizations()
Initialization of extension module libROOTPythonizations.
static int rootmodule_clear(PyObject *m)
static int rootmodule_traverse(PyObject *m, visitproc visit, void *arg)
static PyMethodDef gPyROOTMethods[]
R__EXTERN TSystem * gSystem
A PyObject wrapper to track reference counting of external objects.
PyObjRefCounter(PyObject *object)
PyObjRefCounter & operator=(PyObjRefCounter &&other)
void Reset(PyObject *object)
PyObjRefCounter(const PyObjRefCounter &other)
PyObjRefCounter(PyObjRefCounter &&other)
PyObjRefCounter & operator=(const PyObjRefCounter &other)
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
PyObject * PyObjRefCounterAsStdAny(PyObject *, PyObject *args)
PyObject * AddCPPInstancePickling(PyObject *self, PyObject *args)
Set reduce attribute for CPPInstance objects.
PyObject * CPPInstanceExpand(PyObject *self, PyObject *args)
Deserialize pickled objects.
PyObject * AddPrettyPrintingPyz(PyObject *self, PyObject *args)
Add pretty printing pythonization.
void SetWarningHandler(WarningHandlerFunc_t handler)
For the Python bindings: install an error handler that passes warnings to handler,...
PyObject * Instance_FromVoidPtr(void *addr, const char *classname, int python_owns)