16 Bool_t PyROOT::TConstructorHolder::InitExecutor_( TExecutor*& executor, TCallContext* )
19 executor = CreateExecutor(
"__init__" );
24 PyObject* PyROOT::TConstructorHolder::GetDocString()
27 const std::string& clName = Cppyy::GetFinalName( this->GetScope() );
28 return PyROOT_PyUnicode_FromFormat(
"%s::%s%s",
29 clName.c_str(), clName.c_str(), this->GetMethod() ? this->GetSignatureString().c_str() :
"()" );
35 PyObject* PyROOT::TConstructorHolder::Call(
36 ObjectProxy*&
self, PyObject* args, PyObject* kwds, TCallContext* ctxt )
38 if ( kwds != 0 && PyDict_Size( kwds ) ) {
39 PyErr_SetString( PyExc_TypeError,
"keyword arguments are not yet supported" );
44 if ( Cppyy::IsAbstract( this->GetScope() ) ) {
45 PyErr_Format( PyExc_TypeError,
46 "%s is abstract and can not be instantiated", Cppyy::GetFinalName( this->GetScope() ).c_str() );
51 if ( ! this->Initialize( ctxt ) )
55 if ( ! ( args = this->PreProcessArgs(
self, args, kwds ) ) )
59 if ( ! this->ConvertAndSetArgs( args, ctxt ) ) {
65 Long_t address = (Long_t)this->Execute( 0, 0, ctxt );
76 self->Set( (
void*)address );
79 static Cppyy::TCppType_t sTObjectType = (Cppyy::TCppType_t)Cppyy::GetScope(
"TObject" );
81 if ( Cppyy::IsSubtype( GetScope(), sTObjectType ) ) {
82 TObject*
object = (TObject*)(address + \
83 Cppyy::GetBaseOffset( GetScope(), sTObjectType, (
void*)address, 1 ) );
84 TMemoryRegulator::RegisterObject(
self,
object );
94 if ( ! PyErr_Occurred() )
95 PyErr_SetString( PyExc_TypeError, const_cast< char* >(
96 ( Cppyy::GetFinalName( GetScope() ) +
" constructor failed" ).c_str() ) );