Mercurial > pytave
diff octave_to_python.cc @ 400:6c316b5f30f7
Convert empty 1-D or 2-D arrays to Python array.array (fixes issue #69)
* oct-py-types.cc (pytave::make_py_array): Also convert arrays with zero columns
or zero rows.
* octave_to_python.cc (pytave::octvalue_to_pyobj): Convert numeric arrays with
zero columns or zero rows with make_py_array.
* @pyobject/pyobject.m: Add %!tests.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 28 Apr 2017 10:34:18 -0700 |
parents | 692cecebc71f |
children | 16e79a1e96b8 |
line wrap: on
line diff
--- a/octave_to_python.cc Fri Apr 28 10:13:04 2017 -0700 +++ b/octave_to_python.cc Fri Apr 28 10:34:18 2017 -0700 @@ -183,7 +183,7 @@ py_object = object (handle<PyObject> (obj)); } else if (octvalue.is_numeric_type () && octvalue.ndims () == 2 - && (octvalue.columns () == 1 || octvalue.rows () == 1)) + && (octvalue.columns () <= 1 || octvalue.rows () <= 1)) { PyObject *obj = make_py_array (octvalue); py_object = object (handle<PyObject> (obj));