Mercurial > pytave
comparison @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 |
comparison
equal
deleted
inserted
replaced
364:1470ed26917a | 365:087e7bc3697f |
---|---|
77 if (nargout == 0) | 77 if (nargout == 0) |
78 ## FIXME: should this be available as @pyobject/ismodule.m ? | 78 ## FIXME: should this be available as @pyobject/ismodule.m ? |
79 is_module = pyeval ("lambda x: isinstance(x, __import__('types').ModuleType)"); | 79 is_module = pyeval ("lambda x: isinstance(x, __import__('types').ModuleType)"); |
80 | 80 |
81 if (pycall (is_module, x)) | 81 if (pycall (is_module, x)) |
82 modulename = pycall ("getattr", x, "__name__"); | 82 modulename = char (pycall ("getattr", x, "__name__")); |
83 printf ("Methods for Python module '%s':\n", modulename); | 83 printf ("Methods for Python module '%s':\n", modulename); |
84 else | 84 else |
85 ## FIXME: should be `class (x)` | 85 ## FIXME: should be `class (x)` |
86 classref = pycall ("getattr", x, "__class__"); | 86 classref = pycall ("getattr", x, "__class__"); |
87 classname = pycall ("getattr", classref, "__name__"); | 87 classname = char (pycall ("getattr", classref, "__name__")); |
88 printf ("Methods for Python class '%s':\n", classname); | 88 printf ("Methods for Python class '%s':\n", classname); |
89 endif | 89 endif |
90 disp (list_in_columns (mtds_list)); | 90 disp (list_in_columns (mtds_list)); |
91 else | 91 else |
92 mtds = mtds_list(:); | 92 mtds = mtds_list(:); |