From: mpv Date: Mon, 28 May 2018 10:02:08 +0000 (+0300) Subject: Fix for the issue #2485 : Float parameter is truncated to its integer value X-Git-Tag: V8_5_0rc2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e7619fdb3df37b612acfd127e50e6c41dc7b9680;p=modules%2Fshaper.git Fix for the issue #2485 : Float parameter is truncated to its integer value --- diff --git a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp index e148bdf17..e3cce6120 100644 --- a/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp +++ b/src/InitializationPlugin/InitializationPlugin_PyInterp.cpp @@ -22,6 +22,7 @@ #include #include +#include InitializationPlugin_PyInterp::InitializationPlugin_PyInterp() : PyInterp_Interp() @@ -169,8 +170,13 @@ double InitializationPlugin_PyInterp::evaluate(const std::string& theExpression, Py_XDECREF(anEvalStrObj); double result = 0.; try { + // set locale due to the #2485 + std::string aCurLocale = std::setlocale(LC_NUMERIC, 0); + std::setlocale(LC_NUMERIC, "C"); result = std::stod(anEvalStr); - } catch (const std::invalid_argument&) { + std::setlocale(LC_NUMERIC, aCurLocale.c_str()); + } + catch (const std::invalid_argument&) { theError = "Unable to eval " + anEvalStr; }