From: mkr Date: Wed, 24 May 2006 14:01:13 +0000 (+0000) Subject: Fix for bug PAL12454: REGRESSION: conversion problems from int, long to float, double. X-Git-Tag: V3_2_0rc~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=11f14b4cea97b78f9d27f8ebdbc9e9eac334e2ce;p=modules%2Fsuperv.git Fix for bug PAL12454: REGRESSION: conversion problems from int, long to float, double. --- diff --git a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx index c55437b..3975d60 100644 --- a/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx +++ b/src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx @@ -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 ) ;