31 PyObject* pyclass = PyType_Type.tp_alloc( metatype, nitems );
38 void meta_dealloc( PyRootClass* pytype )
40 return PyType_Type.tp_dealloc( (
PyObject*)pytype );
52 subtype->tp_alloc = (allocfunc)meta_alloc;
53 subtype->tp_dealloc = (destructor)meta_dealloc;
56 PyRootClass* result = (PyRootClass*)PyType_Type.tp_new( subtype, args, kwds );
64 const char* mp = strstr( subtype->tp_name,
"_meta" );
74 std::string( subtype->tp_name ).substr( 0, mp-subtype->tp_name ).c_str() );
85 PyObject* attr = PyType_Type.tp_getattro( pyclass, pyname );
90 PyErr_Fetch( &etype, &value, &trace );
94 if ( name.size() <= 2 || name.substr( 0, 2 ) !=
"__" ) {
110 std::vector< PyCallable* > overloads;
112 for (
size_t imeth = 0; imeth < nmeth; ++imeth ) {
115 overloads.push_back(
new TFunctionHolder( scope, method ) );
133 if ( ! attr && klass ) {
143 Py_INCREF( &PyInt_Type );
148 PyObject_SetAttr( pyclass, pyname, attr );
150 attr = PyType_Type.tp_getattro( pyclass, pyname );
161 attr = PyType_Type.tp_getattro( pyclass, pyname );
163 PyObject_SetAttr( pyclass, pyname, attr );
169 if ( ! attr && etype )
170 PyErr_Restore( etype, value, trace );
172 PyObject* sklass = PyObject_Str( pyclass );
173 PyErr_Format( PyExc_AttributeError,
"%s has no attribute \'%s\'",
188 PyTypeObject PyRootType_Type = {
190 (
char*)
"ROOT.PyRootType",
205 (getattrofunc)pt_getattro,
208 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
209 (
char*)
"PyROOT metatype (internal)",
234 #
if PY_VERSION_HEX >= 0x02030000
237 #
if PY_VERSION_HEX >= 0x02060000
240 #
if PY_VERSION_HEX >= 0x03040000
Bool_t IsNamespace(TCppScope_t scope)
Dictionary for function template This class describes one single function template.
TList * GetListOfEnums(Bool_t load=kTRUE)
Return list containing the TEnums of a class.
Bool_t PyRootType_CheckExact(T *object)
MethodProxy * MethodProxy_New(const std::string &name, std::vector< PyCallable * > &methods)
Bool_t PyRootType_Check(T *object)
TemplateProxy * TemplateProxy_New(const std::string &name, PyObject *pyclass)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
#define PyVarObject_HEAD_INIT(type, size)
PyObject * GetCppGlobal(const std::string &name)
try named global variable/enum (first ROOT, then Cling: sync is too slow)
#define PyROOT_PyUnicode_AsString
Bool_t PropertyProxy_Check(T *object)
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
std::string GetMethodName(TCppMethod_t)
TCppIndex_t GetDatamemberIndex(TCppScope_t scope, const std::string &name)
The ROOT global object gROOT contains a list of all defined classes.
Type object to hold TClassRef instance (this is only semantically a presentation of PyRootType instan...
PyObject * CreateScopeProxy(Cppyy::TCppScope_t)
Convenience function with a lookup first through the known existing proxies.
TCppScope_t GetScope(const std::string &scope_name)
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
#define PyROOT_PyUnicode_CheckExact
TFunctionTemplate * GetFunctionTemplate(const char *name)
TCppIndex_t GetNumMethods(TCppScope_t scope)
PropertyProxy * PropertyProxy_New(Cppyy::TCppScope_t scope, Cppyy::TCppIndex_t idata)
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.