33 if (!PyArg_ParseTuple(args,
const_cast<char *
>(
"O!O|i:DynamicCast"),
41 auto ptr = meth ? PyObject_Call(meth, args,
nullptr) :
nullptr;
49 void *address =
nullptr;
52 }
else if (PyInt_Check(pyobject) || PyLong_Check(pyobject)) {
53 address = (
void *)PyLong_AsLong(pyobject);
58 if (PyErr_Occurred()) {
91 PyObject *pyclass = PyTuple_GetItem(args, 0);
TClass * GetTClass(const CPyCppyy::CPPInstance *pyobj)
PyObject * TClassDynamicCastPyz(CPPInstance *self, PyObject *args)
TClass instances represent classes, structs and namespaces in the ROOT type system.
void * DynamicCast(const TClass *base, void *obj, Bool_t up=kTRUE)
Cast obj of this class type up to baseclass cl if up is true.
virtual const char * GetName() const
Returns name of object.
Py_ssize_t GetBuffer(PyObject *pyobject, char tc, int size, void *&buf, bool check=true)
bool AddToClass(PyObject *pyclass, const char *label, PyCFunction cfunc, int flags=METH_VARARGS)
Set of helper functions that are invoked from the pythonizors, on the Python side.
PyTypeObject CPPInstance_Type
PyObject * BindCppObjectNoCast(Cppyy::TCppObject_t object, Cppyy::TCppType_t klass, const unsigned flags=0)
bool CPPInstance_Check(T *object)
RPY_EXPORTED TCppScope_t GetScope(const std::string &scope_name)
R__EXTERN PyObject * gTClassDynCast
PyObject * AddTClassDynamicCastPyz(PyObject *self, PyObject *args)
Add pythonization for TClass::DynamicCast.