From dc84bfd16ce9c52c649abbf7a4ae62e85b5c3d9f Mon Sep 17 00:00:00 2001 From: tchernobog Date: Fri, 24 Feb 2006 08:28:18 +0000 Subject: [PATCH] - Return numeric_limits::max() from get_time_slice() of PythonPolicy when the Python user-implemented one returns a negative value git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@430 3ecf2c5c-341e-0410-92b4-d18e462d057c --- src/backend/pyloader/python_policy.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/pyloader/python_policy.cc b/src/backend/pyloader/python_policy.cc index 7ebc17e..1ab3ba0 100644 --- a/src/backend/pyloader/python_policy.cc +++ b/src/backend/pyloader/python_policy.cc @@ -19,7 +19,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "python_policy.hh" -#include +#include #include using namespace sgpem; using namespace std; @@ -147,7 +147,8 @@ PythonPolicy::get_time_slice() const throw(UserInterruptException) { // Parse return value stored in global Python object retval = PyDict_GetItemString(_adapter_dict, "_ret_val"); - return static_cast(PyInt_AsLong(retval)); + long tmp = PyInt_AsLong(retval); + return tmp < 0 ? numeric_limits::max() : static_cast(tmp); }