Mercurial > pytave
diff octave_to_python.cc @ 76:ba609c4d77db
load/unload_package, workaround undefined values bug
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 16 Sep 2009 07:31:25 +0200 |
parents | b0991511a16d |
children | ff70627aa203 |
line wrap: on
line diff
--- a/octave_to_python.cc Tue Sep 15 11:23:36 2009 +0200 +++ b/octave_to_python.cc Wed Sep 16 07:31:25 2009 +0200 @@ -306,6 +306,13 @@ const octave_value_list &octave_list) { boost::python::list seq; int length = octave_list.length(); + + // FIXME: due to bugs in Octave 3.2.3 and earlier, lists returned from + // eval_string and feval may be padded by trailing undefined values. + // Fix is already upstream, so this may be eventually removed. + while (length > 0 && octave_list(length-1).is_undefined()) + length--; + for (int i = 0; i < length; i++) { boost::python::object py_object; octvalue_to_pyobj(py_object, octave_list(i));