diff @pyobject/methods.m @ 365:087e7bc3697f

Do not automatically convert Python strings to Octave strings (fixes issue #65) * python_to_octave.cc (pytave::pyobj_to_octvalue): Drop conversion of bytes and unicode objects. * __py_struct_from_dict__.cc (F__py_string_value__): New function. * @pyobject/char.m: Define outside class definition, use __py_string_value__. * @pyobject/pyobject.m: Delete previous pyobject.char definition. * @pyobject/methods.m: Apply char conversion to __name__ attribute. * @py/py.m, @pyobject/cell.m, @pyobject/dummy.m, @pyobject/subsasgn.m, @pyobject/subsref.m, pyargs.m, pycall.cc, pyeval.cc: Adapt examples and tests to changes.
author Mike Miller <mtmiller@octave.org>
date Thu, 25 Aug 2016 14:06:56 -0700
parents de98627cf8ae
children 9d7188514f2c
line wrap: on
line diff
--- a/@pyobject/methods.m	Thu Aug 25 12:11:02 2016 -0700
+++ b/@pyobject/methods.m	Thu Aug 25 14:06:56 2016 -0700
@@ -79,12 +79,12 @@
     is_module = pyeval ("lambda x: isinstance(x, __import__('types').ModuleType)");
 
     if (pycall (is_module, x))
-      modulename = pycall ("getattr", x, "__name__");
+      modulename = char (pycall ("getattr", x, "__name__"));
       printf ("Methods for Python module '%s':\n", modulename);
     else
       ## FIXME: should be `class (x)`
       classref = pycall ("getattr", x, "__class__");
-      classname = pycall ("getattr", classref, "__name__");
+      classname = char (pycall ("getattr", classref, "__name__"));
       printf ("Methods for Python class '%s':\n", classname);
     endif
     disp (list_in_columns (mtds_list));