Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
PyROOT Namespace Reference

Classes

class  RegulatorCleanup
 A TObject-derived class to inject the memory regulation logic in the ROOT list of cleanups. More...
 
class  RPyROOTApplication
 Interactive application for Python. More...
 
class  TMemoryRegulator
 Manages TObject-derived objects created in a PyROOT application. More...
 

Functions

PyObjectAddCPPInstancePickling (PyObject *self, PyObject *args)
 Set reduce attribute for CPPInstance objects.
 
PyObjectAddPrettyPrintingPyz (PyObject *self, PyObject *args)
 Add pretty printing pythonization.
 
PyObjectAddTClassDynamicCastPyz (PyObject *self, PyObject *args)
 Add pythonization for TClass::DynamicCast.
 
PyObjectAddTObjectEqNePyz (PyObject *self, PyObject *args)
 Add pythonization for equality and inequality operators in TObject.
 
PyObjectBranchPyz (PyObject *self, PyObject *args)
 Add pythonization for TTree::Branch.
 
PyObjectClearProxiedObjects (PyObject *self, PyObject *args)
 
PyObjectCPPInstanceExpand (PyObject *self, PyObject *args)
 Deserialize pickled objects.
 
PyObjectGetBranchAttr (PyObject *self, PyObject *args)
 
void Init ()
 
PyObjectRegisterConverterAlias (PyObject *, PyObject *args)
 
PyObjectRegisterExecutorAlias (PyObject *, PyObject *args)
 

Variables

PyObjectgRootModule = nullptr
 

Function Documentation

◆ AddCPPInstancePickling()

PyObject * PyROOT::AddCPPInstancePickling ( PyObject self,
PyObject args 
)

Set reduce attribute for CPPInstance objects.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

The C++ function op_reduce defined above is wrapped in a Python method so that it can be injected in CPPInstance

Definition at line 123 of file CPPInstancePyz.cxx.

◆ AddPrettyPrintingPyz()

PyObject * PyROOT::AddPrettyPrintingPyz ( PyObject self,
PyObject args 
)

Add pretty printing pythonization.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

This function adds the following pythonizations to print the object more user-friendly than cppyy by using the output of cling::printValue as the return value of the special method str.

Definition at line 119 of file GenericPyz.cxx.

◆ AddTClassDynamicCastPyz()

PyObject * PyROOT::AddTClassDynamicCastPyz ( PyObject self,
PyObject args 
)

Add pythonization for TClass::DynamicCast.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

TClass::DynamicCast returns a void* that the user still has to cast (it will have the proper offset, though). Fix this by providing the requested binding if the cast succeeded.

Definition at line 68 of file TClassPyz.cxx.

◆ AddTObjectEqNePyz()

PyObject * PyROOT::AddTObjectEqNePyz ( PyObject self,
PyObject args 
)

Add pythonization for equality and inequality operators in TObject.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

The equality and inequality operators are better implemented in C++, since we need to need to rely on Cppyy's rich comparison if the object we are comparing ourselves with is not a Python proxy or if it contains a null pointer. For example, we need to support the comparison to None.

The rest of comparison operators (i.e. those that define order) can be implemented in Python, throwing a NotImplemented exception if we are not comparing two proxies to TObject or derivate.

Definition at line 81 of file TObjectPyz.cxx.

◆ BranchPyz()

PyObject * PyROOT::BranchPyz ( PyObject self,
PyObject args 
)

Add pythonization for TTree::Branch.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

Modify the behaviour of Branch so that proxy references can be passed as arguments from the Python side, more precisely in cases where the C++ implementation of the method expects the address of a pointer.

For example:

v = ROOT.std.vector('int')()
t.Branch('my_vector_branch', v)

The following signatures are treated in this pythonization:

  • ( const char*, void*, const char*, Int_t = 32000 )
  • ( const char*, const char*, T**, Int_t = 32000, Int_t = 99 )
  • ( const char*, T**, Int_t = 32000, Int_t = 99 )

Definition at line 333 of file TTreePyz.cxx.

◆ ClearProxiedObjects()

PyObject * PyROOT::ClearProxiedObjects ( PyObject self,
PyObject args 
)

Definition at line 69 of file PyROOTWrapper.cxx.

◆ CPPInstanceExpand()

PyObject * PyROOT::CPPInstanceExpand ( PyObject self,
PyObject args 
)

Deserialize pickled objects.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

Helper function that deserializes pickled objects. It needs to be included in the extension module API because otherwise it is not callable from Python. This is important because it will be Python itself calling it when trying to expand a serialized object.

Definition at line 38 of file CPPInstancePyz.cxx.

◆ GetBranchAttr()

PyObject * PyROOT::GetBranchAttr ( PyObject self,
PyObject args 
)

Definition at line 149 of file TTreePyz.cxx.

◆ Init()

void PyROOT::Init ( )

Definition at line 53 of file PyROOTWrapper.cxx.

◆ RegisterConverterAlias()

PyObject * PyROOT::RegisterConverterAlias ( PyObject ,
PyObject args 
)

Definition at line 39 of file PyROOTModule.cxx.

◆ RegisterExecutorAlias()

PyObject * PyROOT::RegisterExecutorAlias ( PyObject ,
PyObject args 
)

Definition at line 51 of file PyROOTModule.cxx.

Variable Documentation

◆ gRootModule

R__EXTERN PyObject * PyROOT::gRootModule = nullptr

Definition at line 37 of file PyROOTModule.cxx.