Mercurial > pytave
comparison 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 |
comparison
equal
deleted
inserted
replaced
399:692cecebc71f | 400:6c316b5f30f7 |
---|---|
181 { | 181 { |
182 PyObject *obj = make_py_tuple (octvalue.cell_value ()); | 182 PyObject *obj = make_py_tuple (octvalue.cell_value ()); |
183 py_object = object (handle<PyObject> (obj)); | 183 py_object = object (handle<PyObject> (obj)); |
184 } | 184 } |
185 else if (octvalue.is_numeric_type () && octvalue.ndims () == 2 | 185 else if (octvalue.is_numeric_type () && octvalue.ndims () == 2 |
186 && (octvalue.columns () == 1 || octvalue.rows () == 1)) | 186 && (octvalue.columns () <= 1 || octvalue.rows () <= 1)) |
187 { | 187 { |
188 PyObject *obj = make_py_array (octvalue); | 188 PyObject *obj = make_py_array (octvalue); |
189 py_object = object (handle<PyObject> (obj)); | 189 py_object = object (handle<PyObject> (obj)); |
190 } | 190 } |
191 else if (octvalue.is_numeric_type () || octvalue.is_string () | 191 else if (octvalue.is_numeric_type () || octvalue.is_string () |