]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Fix for bug PAL12454: REGRESSION: conversion problems from int, long to float, double.
authormkr <mkr@opencascade.com>
Wed, 24 May 2006 14:01:13 +0000 (14:01 +0000)
committermkr <mkr@opencascade.com>
Wed, 24 May 2006 14:01:13 +0000 (14:01 +0000)
src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx

index c55437b4643f0b2feda46487fa53a839e3eec945..3975d607f09e1623c0b947700072c44baaeaca7c 100644 (file)
@@ -575,8 +575,21 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
             ArgValue = Result ;
          }
           if ( !PyFloat_Check( ArgValue ) ) {
-            cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
-            RetVal = false ;
+           // mkr : bug PAL12454
+           if ( PyLong_Check( ArgValue ) ) {
+             cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (long)" << endl ;
+             long l = PyLong_AsLong( ArgValue );
+             f = (float) l;
+           }
+           else if ( PyInt_Check( ArgValue ) ) {
+             cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ;
+             long l = PyInt_AsLong( ArgValue );
+             f = (float) l;
+           }
+           else {
+             cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+             RetVal = false ;
+           }
          }
           else {
             f = PyFloat_AsDouble( ArgValue ) ;
@@ -603,8 +616,21 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
             ArgValue = Result ;
          }
           if ( !PyFloat_Check( ArgValue ) ) {
-            cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (double)" << endl ;
-            RetVal = false ;
+           // mkr : bug PAL12454
+           if ( PyLong_Check( ArgValue ) ) {
+             cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (long)" << endl ;
+             long l = PyLong_AsLong( ArgValue );
+             d = (double) l;
+           }
+           else if ( PyInt_Check( ArgValue ) ) {
+             cdebug << "ArgOut" << i << " : " << sname << " " << method << " OK (int)" << endl ;
+             long l = PyInt_AsLong( ArgValue );
+             d = (double) l;
+           }
+           else {
+             cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+             RetVal = false ;
+           }
          }
           else {
             d = PyFloat_AsDouble( ArgValue ) ;