Mercurial > pytave
diff oct-py-eval.cc @ 411:3613ffbd52b2
Overhaul implicit conversion of arguments and return values
* oct-py-types.cc, oct-py-types.h (pytave::py_implicitly_convert_argument,
pytave::py_implicitly_convert_return_value): New functions.
* __py_struct_from_dict__.cc, oct-py-eval.cc, pycall.cc, pyeval.cc, pyexec.cc:
Use them instead of legacy conversion functions. Add necessary #includes,
remove #includes of legacy header files.
* @pyobject/subsasgn.m, @pyobject/subsref.m: Change %!tests that depend on
NumPy implicit conversion into %!xtests.
* octave_to_python.cc, octave_to_python.h, python_to_octave.cc,
python_to_octave.h: Delete, no longer used.
* Makefile.am (COMMON_SOURCE_FILES, PYTAVE_HEADER_FILES): Remove the files.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Wed, 03 May 2017 16:30:45 -0700 |
parents | aef165ff92b0 |
children | 9bf8ba050122 |
line wrap: on
line diff
--- a/oct-py-eval.cc Tue May 02 17:40:01 2017 -0700 +++ b/oct-py-eval.cc Wed May 03 16:30:45 2017 -0700 @@ -32,7 +32,7 @@ #include "oct-py-eval.h" #include "oct-py-object.h" #include "oct-py-util.h" -#include "octave_to_python.h" +#include "oct-py-types.h" namespace pytave { @@ -63,17 +63,12 @@ for (int i = 0; i < args.length (); ++i) { - boost::python::object arg; - pytave::octvalue_to_pyobj (arg, args(i)); - PyObject *obj = arg.ptr (); + python_object obj = py_implicitly_convert_argument (args(i)); if (pytave::is_py_kwargs_argument (obj)) kwargs = pytave::update_py_dict (kwargs, obj); else - { - Py_INCREF (obj); - PyList_Append (args_list, obj); - } + PyList_Append (args_list, obj.release ()); } python_object args_tuple = PyList_AsTuple (args_list);