# HG changeset patch # User Mike Miller # Date 1469824436 25200 # Node ID 1446812ec1def5b65fd90dfce3ff19eb11562dee # Parent 2cb6e2824776d34dd8fd4dc7a43f7557d15548e1# Parent 0a4f620da178be50d1c104fc21dd3f00b0b486d2 Merged in genuinelucifer/pytave_main (pull request #29) Convert numeric value to long instead of int to avoid overflow (fixes issue #40) diff -r 2cb6e2824776 -r 1446812ec1de pyeval.cc --- a/pyeval.cc Fri Jul 29 13:09:47 2016 -0700 +++ b/pyeval.cc Fri Jul 29 13:33:56 2016 -0700 @@ -141,6 +141,11 @@ %!assert (isa (pyeval ("object()"), "pyobject")) +%!assert (isnumeric (pyeval ("sys.maxsize"))) +%!assert (isnumeric (pyeval ("-sys.maxsize"))) +%!assert (pyeval ("99999999999999"), 99999999999999) +%!assert (pyeval ("-99999999999999"), -99999999999999) + ## FIXME: these will change when dict, list, and tuple are not converted %!assert (pyeval ("{'x': 1, 'y': 2}"), struct ("x", 1, "y", 2)) %!assert (pyeval ("[1, 2, 3]"), {1, 2, 3}) diff -r 2cb6e2824776 -r 1446812ec1de python_to_octave.cc --- a/python_to_octave.cc Fri Jul 29 13:09:47 2016 -0700 +++ b/python_to_octave.cc Fri Jul 29 13:33:56 2016 -0700 @@ -477,7 +477,7 @@ void pyobj_to_octvalue (octave_value& oct_value, const boost::python::object& py_object) { - extract intx (py_object); + extract longx (py_object); extract boolx (py_object); extract doublex (py_object); extract complexx (py_object); @@ -490,8 +490,8 @@ if (boolx.check () && PyBool_Check ((PyArrayObject*)py_object.ptr ())) oct_value = boolx (); - else if (intx.check ()) - oct_value = intx (); + else if (longx.check ()) + oct_value = longx (); else if (doublex.check ()) oct_value = doublex (); else if (complexx.check ())