Salome HOME
Remove useless dependency to py2cpp.
[tools/adao_interface.git] / AdaoExchangeLayer.cxx
index 8e9e28087c4fb37e828299c6f88f8b8d5812c151..4bc42dd0c24f2813da03752d4726d7efdc9b3864 100644 (file)
 #include "PyObjectRAII.hxx"
 #include "Python.h"
 
-#include "py2cpp/py2cpp.hxx"
-
 #include <semaphore.h>
-
 #include <iostream>
 #include <sstream>
 #include <clocale>
@@ -213,6 +210,7 @@ AdaoExchangeLayer::AdaoExchangeLayer()
 
 AdaoExchangeLayer::~AdaoExchangeLayer()
 {
+  AutoGIL agil;
   delete _internal;
 }
 
@@ -319,7 +317,7 @@ private:
   PyObject *_context = nullptr;
 };
 
-void AdaoExchangeLayer::loadTemplate(AdaoModel::MainModel *model)
+void AdaoExchangeLayer::setFunctionCallbackInModel(AdaoModel::MainModel *model)
 {
   AutoGIL agil;
   const char DECORATOR_FUNC[]="def DecoratorAdao(cppFunc):\n"
@@ -346,7 +344,11 @@ void AdaoExchangeLayer::loadTemplate(AdaoModel::MainModel *model)
   //
   Visitor1 visitor(this->_internal->_decorator_func,this->_internal->_context);
   model->visitPythonLeaves(&visitor);
-  //
+}
+
+void AdaoExchangeLayer::loadTemplate(AdaoModel::MainModel *model)
+{
+  AutoGIL agil;
   {
     std::string sciptPyOfModelMaker(model->pyStr());
     PyObjectRAII res(PyObjectRAII::FromNew(PyRun_String(sciptPyOfModelMaker.c_str(),Py_file_input,this->_internal->_context,this->_internal->_context)));