diff octave_to_python.cc @ 399:692cecebc71f

Error on attempt to convert a char array to Python str (fixes issue #75) * octave_to_python.cc (pytave::octvalue_to_pyobj): Throw an exception on attempt to convert a char array with more than one row. * pycall.cc: Add %!tests.
author Mike Miller <mtmiller@octave.org>
date Fri, 28 Apr 2017 10:13:04 -0700
parents 09a1acb81d8b
children 6c316b5f30f7
line wrap: on
line diff
--- a/octave_to_python.cc	Fri Apr 28 09:03:55 2017 -0700
+++ b/octave_to_python.cc	Fri Apr 28 10:13:04 2017 -0700
@@ -164,6 +164,9 @@
     if (octvalue.is_undefined ())
       throw value_convert_exception (
         "Octave value `undefined'. Can not convert to a Python object");
+    else if (octvalue.is_string () && octvalue.rows () > 1)
+      throw value_convert_exception (
+        "Octave multirow char array cannot be converted to a Python object");
     else if (octvalue.is_string ())
       {
         PyObject *obj = make_py_str (octvalue.string_value ());