]> SALOME platform Git repositories - modules/superv.git/blobdiff - src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx
Salome HOME
Update copyright information
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_PyDynInvoke.cxx
index 85fc431b5bea453571f46a6746135542b7c1a930..50bfd9f27a3ff2cc7a9ab3ff676eb1565bb1b133 100644 (file)
@@ -1,14 +1,29 @@
-//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
 //  File   : DataFlowExecutor_PyDynInvoke.cxx
 //  Author : Jean Rahuel, CEA
 //  Module : SUPERV
-//  $Header:
-
+//
 using namespace std;
 
 #include <stdarg.h>
@@ -40,6 +55,15 @@ bool GraphExecutor::InNode::InitPython() {
     Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
     // asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL    
     //_OutNode->SuperVisionContainer()->ActivatePythonExecution( "InitPyRunMethod" , MethodPyRunMethod ) ;
+
+    // PAL10310: patch on omniORB
+    string aPyFunc;
+    aPyFunc = "import omnipatch\n" ;
+    if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) {
+      cdebug << ThreadNo() << " " << Name() << " PyRun_SimpleString ERROR " << endl << aPyFunc << endl ;
+      Automaton()->PyUnLock() ;
+      return false ;
+    }
   }
 //  PyObject * Dictionnary = PyModule_GetDict( Module ) ;
 //  InitPyDynInvokeError = PyErr_NewException( "InitPyDynInvokeError" , NULL , NULL ) ;
@@ -83,8 +107,9 @@ bool GraphExecutor::InNode::InitPython() {
     aPyFunc += "import sys\n" ;
     aPyFunc += "import CORBA\n" ;
     aPyFunc += "import omniORB\n" ;
+    aPyFunc += "orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
     aPyFunc += "def PyObjRef( IORObjStr ) :\n" ;
-    aPyFunc += "    orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
+    //    aPyFunc += "    orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
     aPyFunc += "    objref = orb.string_to_object( IORObjStr )\n" ;
     aPyFunc += "    return objref\n" ;
     aPyFunc += "InitPyRunMethod.RunMethod( PyObjRef )\n" ;
@@ -109,8 +134,9 @@ bool GraphExecutor::InNode::InitPython() {
     aPyFunc += "import sys\n" ;
     aPyFunc += "import CORBA\n" ;
     aPyFunc += "import omniORB\n" ;
+    aPyFunc += "orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
     aPyFunc += "def PyObjIor( ObjRef ) :\n" ;
-    aPyFunc += "    orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
+    //    aPyFunc += "    orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
     aPyFunc += "    objIor = orb.object_to_string( ObjRef )\n" ;
     aPyFunc += "    return objIor\n" ;
     aPyFunc += "InitPyRunMethod.RunMethod( PyObjIor )\n" ;
@@ -158,6 +184,19 @@ PyObject * GraphExecutor::InNode::InitPyDynInvoke( char * PyFuncName ,
   if ( strlen( PyFuncName ) ) {
     Automaton()->PyLock() ;
     thePyRunMethod = Automaton()->PyFunction( PyFuncName ) ;
+    
+    //thePyRunMethod = NULL; 
+    // asv 28.02.05 : VERY BAD fix of the following problem: after change of a function, 
+    // the changes are NOT taken into account by Automation - it returns PyObject of the OLD function.
+    // so here we force re-automating the PyObject EVERY TIME, regardless if the function has changed or not.
+    // Once again - it is a very bad solution, it fully discards the whole idea of automation,
+    // here is it done as a quick fix for a bug. 
+    // A better solution (to be implemented): store the PyObject NOT in Automation map, but in
+    // InLine node itself!  And if the method is changed - remove the PyObject and force to regenerate it.
+    // But this means that PyObject must be stored in Editor's data model.
+    // asv 01.03.05 : the fix is not needed, the described bug is not reproduced.  To investigate:
+    // WHERE PyObject is removed from Automation map on function change. 
+
     if ( (*aPythonFunction).length() ) {
       if ( thePyRunMethod == NULL ) {
        unsigned int i ;
@@ -225,7 +264,7 @@ extern "C" PyObject * PyRunMethod( PyObject * dummy , PyObject * Args ) {
   return Result ;
 }
 
-#define PyDynInvokeTrace 1
+#define PyDynInvokeTrace 0
 bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
                                         const char *method , 
                                         ServicesAnyData * InParametersList , int nInParams ,
@@ -261,9 +300,9 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
   PyObject * ArgsList = NULL ;
   PyObject * ArgValue = NULL ;
   PyObject * Result = NULL ;
-  PyObject * MyPyObjRefList = NULL ;
+  //PyObject * MyPyObjRefList = NULL ;
   PyObject * ResultObj = NULL ;
-  PyObject * MyPyObjIorList = NULL ;
+  //PyObject * MyPyObjIorList = NULL ;
   PyObject * ResultIor = NULL ;
 
   CORBA::Object_ptr ObjRef ;
@@ -282,7 +321,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
       sname = InParametersList[i].Name.c_str() ;
       switch ( data.type()->kind() ) {
       case CORBA::tk_string : {
-        char * t ;
+        const char * t ;
         data >>= t ;
         PyObject * ArgValue = Py_BuildValue( "s" , t ) ;
         PyTuple_SetItem( ArgsList , i , ArgValue ) ;
@@ -318,7 +357,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
         break ;
       }
       case CORBA::tk_short : {
-        short s ;
+        CORBA::Short s ;
         data >>= s ;
         PyObject * ArgValue = Py_BuildValue( "h" , s ) ;
         PyTuple_SetItem( ArgsList , i , ArgValue ) ;
@@ -330,9 +369,16 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
         break ;
       }
       case CORBA::tk_long : {
-        long l ;
+        CORBA::Long l ;
         data >>= l ;
-        PyObject * ArgValue = Py_BuildValue( "l" , l ) ;
+//      epa - Porting to 64-bit Linux:CORBA::Long is incorrectly treated as unsigned 
+//            integer by Py_BuildValue("l", val) in Python 2.4.1. Using Py_BuildValue("i",val) 
+//            seemsto help
+        PyObject * ArgValue = NULL;
+        if ( SIZEOF_LONG == 4 )
+           ArgValue = Py_BuildValue( "l" , l ) ;
+       else
+           ArgValue = Py_BuildValue( "i" , l ) ;
 #if PyDynInvokeTrace
         cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l
                << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
@@ -340,13 +386,13 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
         PyTuple_SetItem( ArgsList , i , ArgValue ) ;
 #if PyDynInvokeTrace
         cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l
-               << " (long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+               << " (CORBA::Long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
                << ArgValue->ob_refcnt << endl ;
 #endif
         break ;
       }
       case CORBA::tk_float : {
-        float f ;
+        CORBA::Float f ;
         data >>= f ;
         PyObject * ArgValue = Py_BuildValue( "f" , f ) ;
         PyTuple_SetItem( ArgsList , i , ArgValue ) ;
@@ -358,7 +404,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
         break ;
       }
       case CORBA::tk_double : {
-        double d ;
+        CORBA::Double d ;
         data >>= d ;
         PyObject * ArgValue = Py_BuildValue( "d" , d ) ;
         PyTuple_SetItem( ArgsList , i , ArgValue ) ;
@@ -370,42 +416,61 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
         break ;
       }
       case CORBA::tk_objref : {
-        MyPyObjRefList = PyTuple_New( 1 ) ;
-        PyObject * ObjValue ;
+        //MyPyObjRefList = PyTuple_New( 1 ) ;
+        //PyObject * ObjValue ;
 #if OMNIORB_VERSION >= 4
         data >>= (CORBA::Any::to_object ) ObjRef ;
 #else
         data >>= ObjRef ;
 #endif
         IORObjRef = ObjectToString( ObjRef ) ;
-        ObjValue = Py_BuildValue( "s" , IORObjRef ) ;
-        PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ;
+        //ObjValue = Py_BuildValue( "s" , IORObjRef ) ;
+        //PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ;
 #if PyDynInvokeTrace
-        cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) "
-               << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ;
+        cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) "<< endl ;
+       //             << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ;
 #endif
 //        ResultObj = PyEval_CallObject( MyPyObjRef , MyPyObjRefList ) ;
-        ResultObj = PyEvalCallObject( "PyObjRef" , MyPyObjRef , MyPyObjRefList ) ;
-#if PyDynInvokeTrace
-        cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ;
-#endif
-        ArgValue = Py_BuildValue( "O" , ResultObj ) ;
-        PyTuple_SetItem( ArgsList , i , ArgValue ) ;
-#if PyDynInvokeTrace
+         //ResultObj = PyEvalCallObject( "PyObjRef" , MyPyObjRef , MyPyObjRefList ) ;
+#if PyDynInvokeTrace
+         //cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ;
+#endif
+         //ArgValue = Py_BuildValue( "O" , ResultObj ) ;
+         //PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+#if PyDynInvokeTrace
+       if ( ArgValue )
+         cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value  (objref) ArgsList->ob_refcnt"
+                << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
+       else
+         cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value  (objref) ArgsList->ob_refcnt"
+                << ArgsList->ob_refcnt << " ArgValue is NULL" << endl ;
+        //cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
+#endif
+       ResultObj = PyObject_CallFunction( MyPyObjRef , "s",IORObjRef ) ;
+       if(ResultObj == NULL){
+         PyErr_Print();
+         ResultObj=Py_None;
+          Py_INCREF(ResultObj) ;
+       }
+        PyTuple_SetItem( ArgsList , i , ResultObj ) ;
         cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value  (objref) ArgsList->ob_refcnt"
-               << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
-        cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
-#endif
-        Py_DECREF( MyPyObjRefList ) ;
-        if ( CORBA::is_nil( ObjRef ) ) {
-          ResultObj = NULL ;
-        }
-        else {
-#if PyDynInvokeTrace
-          cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
-#endif
-          Py_DECREF( ResultObj ) ;
-        }
+              << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ResultObj->ob_refcnt << endl ;
+//       << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
+        //cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
+        //Py_DECREF( MyPyObjRefList ) ;
+        //if ( CORBA::is_nil( ObjRef ) ) {
+        //  ResultObj = NULL ;
+        //}
+        //else {
+       //#if PyDynInvokeTrace
+       //if ( ResultObj )
+       //cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
+       //else
+       //cdebug << "ResultObj is NULL" << endl ;
+       //#endif
+       //if ( ResultObj )
+       //Py_DECREF( ResultObj ) ;
+        //}
         break ;
       }
       default : {
@@ -424,6 +489,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
     if ( Result == NULL ) {
       cdebug_out << "GraphExecutor::InNode::PyDynInvoke Node " << Name() << " " << method << " Error Result == NULL"
                  << endl ;
+      PyErr_Print();
       RetVal = false ;
     }
     else {
@@ -440,7 +506,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             ArgValue = Result ;
          }
-          if ( !PyString_Check( ArgValue ) ) {
+          if ( !ArgValue || !PyString_Check( ArgValue ) ) {
             cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (string)" << endl ;
             RetVal = false ;
          }
@@ -449,9 +515,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
          }
           data <<= t ;
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)"
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
-                 << ArgValue->ob_refcnt << endl ;
+         if ( ArgValue )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)"
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
+                  << ArgValue->ob_refcnt << endl ;
 #endif
           break ;
         }
@@ -464,7 +531,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             ArgValue = Result ;
          }
-          if ( !PyInt_Check( ArgValue ) ) {
+          if ( !ArgValue || !PyInt_Check( ArgValue ) ) {
             cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (boolean)" << endl ;
             RetVal = false ;
          }
@@ -473,9 +540,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
          }
           data <<= (CORBA::Any::from_boolean ) b ;
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << b << " (boolean)"
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
-                 << ArgValue->ob_refcnt << endl ;
+         if ( ArgValue )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << b << " (boolean)"
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
+                  << ArgValue->ob_refcnt << endl ;
 #endif
           break ;
         }
@@ -491,7 +559,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
 //JR 04.04.2005 Debug          if ( !PyInt_Check( ArgValue ) ) {
 //Difficult to understand that behavior ... Python char type is a string of length 1 !
 //                                          or type is int ...
-          if ( !PyString_Check( ArgValue ) && !PyInt_Check( ArgValue ) ) {
+          if ( !ArgValue || !PyString_Check( ArgValue ) && !PyInt_Check( ArgValue ) ) {
             cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (char)" << endl ;
             RetVal = false ;
          }
@@ -500,9 +568,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
          }
           data <<= (CORBA::Any::from_char ) c ;
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << c << " (char)"
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
-                 << ArgValue->ob_refcnt << endl ;
+         if ( ArgValue )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << c << " (char)"
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
+                  << ArgValue->ob_refcnt << endl ;
 #endif
           break ;
         }
@@ -515,7 +584,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             ArgValue = Result ;
          }
-          if ( !PyInt_Check( ArgValue ) ) {
+          if ( !ArgValue || !PyInt_Check( ArgValue ) ) {
             cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (short)" << endl ;
             RetVal = false ;
          }
@@ -524,14 +593,15 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
          }
           data <<= s ;
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << s << " (short)"
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
-                 << ArgValue->ob_refcnt << endl ;
+         if ( ArgValue )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << s << " (short)"
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
+                  << ArgValue->ob_refcnt << endl ;
 #endif
           break ;
         }
         case CORBA::tk_long : {
-          long l = 0 ;
+          CORBA::Long l = 0 ;
           PyObject * ArgValue ;
           if ( PyTuple_Check( Result ) ) {
             ArgValue = PyTuple_GetItem( Result , i ) ;
@@ -539,10 +609,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             ArgValue = Result ;
          }
-          if ( PyLong_Check( ArgValue ) ) {
+          if ( ArgValue && PyLong_Check( ArgValue ) ) {
             l = PyLong_AsLong( ArgValue ) ;
          }
-          else if ( PyInt_Check( ArgValue ) ) {
+          else if ( ArgValue && PyInt_Check( ArgValue ) ) {
             l = PyInt_AsLong( ArgValue ) ;
          }
           else {
@@ -551,9 +621,10 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
          }
           data <<= l ;
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (long)"
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
-                 << ArgValue->ob_refcnt << endl ;
+         if ( ArgValue )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (CORBA::Long)"
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
+                  << ArgValue->ob_refcnt << endl ;
 #endif
           break ;
         }
@@ -566,18 +637,43 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             ArgValue = Result ;
          }
-          if ( !PyFloat_Check( ArgValue ) ) {
-            cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
-            RetVal = false ;
+         if ( ArgValue ) {
+           if ( !PyFloat_Check( ArgValue ) ) {
+             // mkr : bug PAL12454
+             if ( PyLong_Check( ArgValue ) ) {
+               cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (CORBA::Long)" << endl ;
+               CORBA::Long l = PyLong_AsLong( ArgValue );
+               f = (float) l;
+             }
+             else if ( PyInt_Check( ArgValue ) ) {
+               cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ;
+               CORBA::Long l = PyInt_AsLong( ArgValue );
+               f = (float) l;
+             }
+             else {
+               cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+               RetVal = false ;
+             }
+           }
+           else {
+             f = PyFloat_AsDouble( ArgValue ) ;
+           }
          }
-          else {
-            f = PyFloat_AsDouble( ArgValue ) ;
+         else {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+           RetVal = false ;
          }
+#ifdef REDHAT // mkr : debug for PAL12255
           data <<= f ;
+#else
+//JR     data.replace(CORBA::TypeCode::PR_float_tc(), (void*)(&f));
+          data <<= (CORBA::Float) f ;
+#endif
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)"
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
-                 << ArgValue->ob_refcnt << endl ;
+         if ( ArgValue )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)"
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
+                  << ArgValue->ob_refcnt << endl ;
 #endif
           break ;
         }
@@ -590,24 +686,49 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
           else {
             ArgValue = Result ;
          }
-          if ( !PyFloat_Check( ArgValue ) ) {
-            cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (double)" << endl ;
-            RetVal = false ;
+         if ( ArgValue ) {
+           if ( !PyFloat_Check( ArgValue ) ) {
+             // mkr : bug PAL12454
+             if ( PyLong_Check( ArgValue ) ) {
+               cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (CORBA::Long)" << endl ;
+               CORBA::Long l = PyLong_AsLong( ArgValue );
+               d = (double) l;
+             }
+             else if ( PyInt_Check( ArgValue ) ) {
+               cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ;
+               CORBA::Long l = PyInt_AsLong( ArgValue );
+               d = (double) l;
+             }
+             else {
+               cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+               RetVal = false ;
+             }
+           }
+           else {
+             d = PyFloat_AsDouble( ArgValue ) ;
+           }
          }
-          else {
-            d = PyFloat_AsDouble( ArgValue ) ;
+         else {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+           RetVal = false ;
          }
+#ifdef REDHAT // mkr : debug for PAL12255
           data <<= d ;
+#else
+//JR     data.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
+          data <<= (CORBA::Double) d ;
+#endif
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
-                 << ArgValue->ob_refcnt << endl ;
+         if ( ArgValue )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ArgValue->ob_refcnt"
+                  << ArgValue->ob_refcnt << endl ;
 #endif
           break ;
         }
         case CORBA::tk_objref : {
           PyObject * ObjIor ;
-          MyPyObjIorList = PyTuple_New( 1 ) ;
+          //MyPyObjIorList = PyTuple_New( 1 ) ;
           if ( PyTuple_Check( Result ) ) {
             ObjIor = PyTuple_GetItem( Result , i ) ;
          }
@@ -615,25 +736,28 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
             ObjIor = Result ;
          }
 #if PyDynInvokeTrace
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "
-                 << " Result->ob_refcnt" << Result->ob_refcnt << " ObjIor->ob_refcnt"
-                 << ObjIor->ob_refcnt << endl ;
+         if ( ObjIor )
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "
+                  << " Result->ob_refcnt" << Result->ob_refcnt << " ObjIor->ob_refcnt"
+                  << ObjIor->ob_refcnt << endl ;
 #endif
-          Py_INCREF( ObjIor ) ;
+          //Py_INCREF( ObjIor ) ;
 //          PyObject_Print( ObjIor , stdout , 0 ) ;
-          PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
+          //PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
 //          ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ;
-          ResultIor = PyEvalCallObject( "PyObjIor" , MyPyObjIor , MyPyObjIorList ) ;
+          //ResultIor = PyEvalCallObject( "PyObjIor" , MyPyObjIor , MyPyObjIorList ) ;
+         ResultIor = PyObject_CallFunction( MyPyObjIor , "O",ObjIor ) ;
 #if PyDynInvokeTrace
-          cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ;
+         if ( ObjIor )
+           cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ;
 #endif
-          Py_DECREF( ObjIor ) ;
+          //Py_DECREF( ObjIor ) ;
 #if PyDynInvokeTrace
-          cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ;
+          //cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ;
 #endif
-          Py_DECREF( MyPyObjIorList ) ;
+          //Py_DECREF( MyPyObjIorList ) ;
 #if PyDynInvokeTrace
-          cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ;
+          //cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ;
 #endif
           if ( ResultIor ) {
             char * IOR = NULL ;
@@ -700,6 +824,7 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
            }
          }
           else {
+           PyErr_Print();
             cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL Node "
                        << Name() << " method " << method << " " << endl ;
             RetVal = false ;
@@ -767,6 +892,9 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
     Py_DECREF( ArgsList ) ;
   }
 
+  fflush(stdout);
+  fflush(stderr);
+
 #if 0
   {
     int i ;