diff --git a/bindings/pyroot/src/Adapters.cxx b/bindings/pyroot/src/Adapters.cxx index 743cca6639aa40e25973090246c23bdb8f7f387e..aa5c2c01a8fb0317c89b7d7144ff2997b8083181 100644 --- a/bindings/pyroot/src/Adapters.cxx +++ b/bindings/pyroot/src/Adapters.cxx @@ -236,10 +236,16 @@ PyROOT::TScopeAdapter::TScopeAdapter( const TMemberAdapter& mb ) : } //____________________________________________________________________________ -PyROOT::TScopeAdapter PyROOT::TScopeAdapter::ByName( const std::string & name ) +PyROOT::TScopeAdapter PyROOT::TScopeAdapter::ByName( const std::string & name, bool quiet ) { // lookup a scope (class) by name - return TClass::GetClass( name.c_str() ); + Int_t oldEIL = gErrorIgnoreLevel; + if ( quiet ) + gErrorIgnoreLevel = 3000; + TClass* klass = TClass::GetClass( name.c_str() ); + gErrorIgnoreLevel = oldEIL; + + return klass; } //____________________________________________________________________________ diff --git a/bindings/pyroot/src/Adapters.h b/bindings/pyroot/src/Adapters.h index 26e1c8738fbda9cfc6604b1d4a4335d2673c89b3..d003eb08ffc4fc6cc16b6d0ff63193d14c5d93a2 100644 --- a/bindings/pyroot/src/Adapters.h +++ b/bindings/pyroot/src/Adapters.h @@ -110,7 +110,7 @@ public: operator bool() const; public: - static TScopeAdapter ByName( const std::string & name ); + static TScopeAdapter ByName( const std::string& name, bool quiet = true ); public: std::string Name( unsigned int mod = 0 ) const; diff --git a/bindings/pyroot/src/RootWrapper.cxx b/bindings/pyroot/src/RootWrapper.cxx index 6a7cc44334c41c5ccb18a0565303fdd14c0b9560..19aa53953c51d000856e5583951aeddab561d3dd 100644 --- a/bindings/pyroot/src/RootWrapper.cxx +++ b/bindings/pyroot/src/RootWrapper.cxx @@ -177,18 +177,17 @@ namespace { if ( klass != 0 ) TClass::RemoveClass( (TClass*)klass ); - // load base class std::exception if not yet done so, and refresh - if ( gSTLTypes.find( "exception" ) != gSTLTypes.end() ) { - gROOT->ProcessLine( "#include <exception>" ); - TClass::RemoveClass( TClass::GetClass( "std::exception" ) ); - gSTLTypes.erase( gSTLTypes.find( "exception" ) ); - gSTLTypes.erase( gSTLTypes.find( "std::exception" ) ); - } - // load stdexcept, which contains all std exceptions gROOT->ProcessLine( "#include <stdexcept>" ); gSTLExceptions.clear(); // completely done with std exceptions + // <stdexcept> will load <exception> for the std::exception base class + std::set< std::string >::iterator excpos = gSTLTypes.find( "exception" ); + if ( excpos != gSTLTypes.end() ) { + gSTLTypes.erase( excpos ); + gSTLTypes.erase( gSTLTypes.find( "std::exception" ) ); + } + return kTRUE; } @@ -490,7 +489,7 @@ PyObject* PyROOT::MakeRootClassFromString( const std::string& fullname, PyObject // retrieve ROOT class (this verifies name) const std::string& lookup = scope ? (scName+"::"+name) : name; T klass = T::ByName( lookup ); - if ( ! (bool)klass || ( (bool)klass && klass.FunctionMemberSize() == 0 ) ) { + if ( ! (bool)klass || klass.FunctionMemberSize() == 0 ) { // special action for STL classes to enforce loading dict lib LoadDictionaryForSTLType( name, klass.Id() );