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); }