changeset 289:49832ca978fd

Use new subsref indexing to fix the failing tests * @pyobject/methods.m, @pyobject/fieldnames.m: Use the new subsref indexing to convert the pyobject to octave cell before returning
author Abhinav Tripathi <genuinelucifer@gmail.com>
date Wed, 03 Aug 2016 00:22:20 -0700
parents f5282c87e5d5
children f2b4576879a6
files @pyobject/fieldnames.m @pyobject/methods.m
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/@pyobject/fieldnames.m	Wed Aug 03 00:18:40 2016 -0700
+++ b/@pyobject/fieldnames.m	Wed Aug 03 00:22:20 2016 -0700
@@ -52,8 +52,10 @@
                  " and not isinstance(getattr(x, a), __import__('types').ModuleType)" ...
                  " and not a.startswith('_')]"]);
 
-  # FIXME: may need to convert from Python list to Octave cell array
-  names = pycall (cmd, x);
+  names_obj = pycall (cmd, x);
+  len = length (names_obj);
+  idx = struct ("type", "{}", "subs", {{1:len}});
+  [names{1:len}] = subsref (names_obj, idx);
   names = names(:);
 
 endfunction
--- a/@pyobject/methods.m	Wed Aug 03 00:18:40 2016 -0700
+++ b/@pyobject/methods.m	Wed Aug 03 00:22:20 2016 -0700
@@ -71,8 +71,10 @@
   cmd = pyeval (["lambda x: [a for a in dir(x)" ...
                  " if callable(getattr(x, a)) and not a.startswith('_')]"]);
 
-  # FIXME: may need to convert from Python list to Octave cell array
-  mtds_list = pycall (cmd, x)
+  mtds_list_obj = pycall (cmd, x);
+  len = length (mtds_list_obj);
+  idx = struct ("type", "{}", "subs", {{1:len}});
+  [mtds_list{1:len}] = subsref (mtds_list_obj, idx);
 
   if (nargout == 0)
     ## FIXME: should this be available as @pyobject/ismodule.m ?