- Return numeric_limits<int>::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
This commit is contained in:
parent
924896ca0b
commit
dc84bfd16c
|
@ -19,7 +19,7 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "python_policy.hh"
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <unistd.h>
|
||||
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<int>(PyInt_AsLong(retval));
|
||||
long tmp = PyInt_AsLong(retval);
|
||||
return tmp < 0 ? numeric_limits<int>::max() : static_cast<int>(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue