From: Gilles DAVID Date: Wed, 27 Sep 2023 16:02:31 +0000 (+0200) Subject: Fix Python exception X-Git-Tag: V9_12_0a1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6d77d058b5a080a43c7fabe123c69bcf163e61df;p=modules%2Fkernel.git Fix Python exception --- diff --git a/src/SALOMESDS/SALOME_DataScopeServer_Common.cxx b/src/SALOMESDS/SALOME_DataScopeServer_Common.cxx index 370c8c36a..7067131d7 100644 --- a/src/SALOMESDS/SALOME_DataScopeServer_Common.cxx +++ b/src/SALOMESDS/SALOME_DataScopeServer_Common.cxx @@ -53,32 +53,34 @@ int CommonDataScopeServerMain(int argc, char *argv[], CORBA::ORB_var orb, const SALOMESDS::DataScopeKiller *killer(new SALOMESDS::DataScopeKiller(orb)); SALOME::DataScopeKiller_var killerObj(killer->_this()); // - SALOME_CPythonHelper cPyHelper; - cPyHelper.initializePython(argc,argv); - // - SALOMESDS::DataScopeServerBase *server(nullptr); - if(!isTransac) - server=new SALOMESDS::DataScopeServer(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb)); - else - server=new SALOMESDS::DataScopeServerTransaction(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb)); - // - CORBA::PolicyList policies; - policies.length(3); - PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); - policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol); - policies[1]=poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION); - policies[2]=poa->create_id_uniqueness_policy(PortableServer::UNIQUE_ID); - PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",mgr,policies)); - threadPol->destroy(); - server->registerToSalomePiDict(); - // - server->setPOA(poa2); - obj=server->activate(); - SALOME::DataScopeServerBase_var serverPtr(SALOME::DataScopeServerBase::_narrow(obj)); - server->registerInNS(serverPtr); - // - orb->run(); - delete killer; + { + SALOME_CPythonHelper cPyHelper; + cPyHelper.initializePython(argc,argv); + // + SALOMESDS::DataScopeServerBase *server(nullptr); + if(!isTransac) + server=new SALOMESDS::DataScopeServer(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb)); + else + server=new SALOMESDS::DataScopeServerTransaction(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb)); + // + CORBA::PolicyList policies; + policies.length(3); + PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); + policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol); + policies[1]=poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION); + policies[2]=poa->create_id_uniqueness_policy(PortableServer::UNIQUE_ID); + PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",mgr,policies)); + threadPol->destroy(); + server->registerToSalomePiDict(); + // + server->setPOA(poa2); + obj=server->activate(); + SALOME::DataScopeServerBase_var serverPtr(SALOME::DataScopeServerBase::_narrow(obj)); + server->registerInNS(serverPtr); + // + orb->run(); + delete killer; + } Py_Finalize(); return 0; }