Salome HOME
updated copyright message
[modules/kernel.git] / src / LifeCycleCORBA_SWIG / libSALOME_LifeCycleCORBA.i
index ecfef6ab9b6739583c501e21a57ca58473ddb167..3cb8a98403fb5e285f08f470bde2ed52a969681a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -45,27 +45,9 @@ typedef int Py_ssize_t;
 #define PY_SSIZE_T_MIN INT_MIN
 #endif
 
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-
-struct omniORBpyAPI {
-
-  PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-                                   CORBA::Boolean hold_lock);
-  // Convert a C++ object reference to a Python object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-  CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-                                           CORBA::Boolean hold_lock);
-  // Convert a Python object reference to a C++ object reference.
-  // Raises BAD_PARAM if the Python object is not an object reference.
-  // If <hold_lock> is true, caller holds the Python interpreter lock.
-
-
-  omniORBpyAPI();
-  // Constructor for the singleton. Sets up the function pointers.
-};
-
-omniORBpyAPI* api;
+#include <Python.h>
+#include <omniORBpy.h>
+omniORBpyAPI* api=0;
 
 %}
 
@@ -84,7 +66,7 @@ omniORBpyAPI* api;
     return NULL;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
-  api = (omniORBpyAPI*)PyCapsule_New(pyapi,NULL,NULL);
+  api = (omniORBpyAPI*)PyCapsule_GetPointer(pyapi,"_omnipy.API");
   Py_DECREF(pyapi);
 %}
 
@@ -214,7 +196,7 @@ omniORBpyAPI* api;
     try {
       $action
     }
-    catch (ServiceUnreachable) {
+    catch (ServiceUnreachable&) {
        Py_BLOCK_THREADS
        PyErr_SetString(PyExc_RuntimeError,"Naming Service Unreacheable");
        return NULL;