diff python_to_octave.cc @ 409:b9b8790d1082

Add overload of py_isinstance taking a string decribing a type * oct-py-util.h (pytave::py_isinstance): New function overload. * __py_struct_from_dict__.cc (F__py_isinstance__): Use it. * python_to_octave.cc (pytave::pyobj_to_octvalue): Use it.
author Mike Miller <mtmiller@octave.org>
date Tue, 02 May 2017 17:44:02 -0700
parents 16e79a1e96b8
children 95c6ad0be828
line wrap: on
line diff
--- a/python_to_octave.cc	Tue May 02 10:06:14 2017 -0700
+++ b/python_to_octave.cc	Tue May 02 17:44:02 2017 -0700
@@ -311,7 +311,6 @@
   void pyobj_to_octvalue (octave_value& oct_value,
                           const boost::python::object& py_object)
   {
-    boost::python::extract<boost::python::numeric::array> arrayx (py_object);
 
     if (PyBool_Check (py_object.ptr ()))
       oct_value = extract_py_bool (py_object.ptr ());
@@ -323,7 +322,7 @@
       oct_value = extract_py_float (py_object.ptr ());
     else if (PyComplex_Check (py_object.ptr ()))
       oct_value = extract_py_complex (py_object.ptr ());
-    else if (arrayx.check ())
+    else if (py_isinstance (py_object.ptr (), "numpy.ndarray"))
       pyarr_to_octvalue (oct_value, (PyArrayObject*)py_object.ptr ());
     else
       oct_value = pyobject_wrap_object (py_object.ptr ());