Mercurial > pytave
changeset 415:9bf8ba050122
Replace all remaining Boost.Python references
* exceptions.h (pytave::error_alreadY_set): New exception placeholder class.
* __py_struct_from_dict__.cc, oct-py-eval.cc, oct-py-types.cc, oct-py-util.cc,
pycall.cc, pyeval.cc, pyexec.cc: Use it in place of boost::python. Remove all
#includes of Boost headers.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Wed, 03 May 2017 21:48:07 -0700 |
parents | ee6afd27a78c |
children | aeed116cf9f9 |
files | __py_struct_from_dict__.cc exceptions.h oct-py-eval.cc oct-py-types.cc oct-py-util.cc pycall.cc pyeval.cc pyexec.cc |
diffstat | 8 files changed, 15 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/__py_struct_from_dict__.cc Wed May 03 20:32:10 2017 -0700 +++ b/__py_struct_from_dict__.cc Wed May 03 21:48:07 2017 -0700 @@ -33,9 +33,6 @@ #include "oct-py-types.h" #include "oct-py-util.h" -// FIXME: only here for exception types still used in this file -#include <boost/python/errors.hpp> - DEFUN_DLD (__py_class_name__, args, , "-*- texinfo -*-\n\ @deftypefn {} {} __py_class_name__ (@var{obj})\n\ @@ -104,7 +101,7 @@ { error ("pyobject.int64: argument must be a Python int or long object"); } - catch (boost::python::error_already_set const &) + catch (pytave::error_already_set const &) { std::string message = pytave::fetch_exception_message (); error ("pyobject.int64: %s", message.c_str ()); @@ -156,7 +153,7 @@ { error ("pyobject.uint64: argument must be a Python int or long object"); } - catch (boost::python::error_already_set const &) + catch (pytave::error_already_set const &) { std::string message = pytave::fetch_exception_message (); error ("pyobject.uint64: %s", message.c_str ());
--- a/exceptions.h Wed May 03 20:32:10 2017 -0700 +++ b/exceptions.h Wed May 03 21:48:07 2017 -0700 @@ -83,6 +83,10 @@ std::string error; }; + class error_already_set + { + }; + std::string fetch_exception_message (void); }
--- a/oct-py-eval.cc Wed May 03 20:32:10 2017 -0700 +++ b/oct-py-eval.cc Wed May 03 21:48:07 2017 -0700 @@ -25,10 +25,10 @@ #endif #include <string> -#include <boost/python.hpp> #include <octave/ov.h> #include <octave/ovl.h> +#include "exceptions.h" #include "oct-py-eval.h" #include "oct-py-object.h" #include "oct-py-util.h" @@ -83,7 +83,7 @@ { python_object retval = PyEval_CallObjectWithKeywords (callable, args, kwargs); if (! retval) - throw boost::python::error_already_set (); + throw pytave::error_already_set (); return retval.release (); } @@ -118,7 +118,7 @@ Py_DECREF (globals); if (! retval) - throw boost::python::error_already_set (); + throw pytave::error_already_set (); return retval.release (); }
--- a/oct-py-types.cc Wed May 03 20:32:10 2017 -0700 +++ b/oct-py-types.cc Wed May 03 21:48:07 2017 -0700 @@ -36,9 +36,6 @@ #include "oct-py-types.h" #include "oct-py-util.h" -// FIXME: only here for exception types still used in this file -#include <boost/python/errors.hpp> - namespace pytave { @@ -357,7 +354,7 @@ PyObject *item = py_implicitly_convert_argument (map.contents (p)); if (PyDict_SetItem (dict, key, item) < 0) - throw boost::python::error_already_set (); + throw pytave::error_already_set (); } return dict;
--- a/oct-py-util.cc Wed May 03 20:32:10 2017 -0700 +++ b/oct-py-util.cc Wed May 03 21:48:07 2017 -0700 @@ -27,13 +27,11 @@ #include <oct.h> #include <octave/parse.h> +#include "exceptions.h" #include "oct-py-object.h" #include "oct-py-types.h" #include "oct-py-util.h" -// FIXME: only here for boost::python::error_already_set -#include <boost/python.hpp> - namespace pytave { @@ -173,7 +171,7 @@ } if (! dict) - throw boost::python::error_already_set (); + throw pytave::error_already_set (); objstore = dict; }
--- a/pycall.cc Wed May 03 20:32:10 2017 -0700 +++ b/pycall.cc Wed May 03 21:48:07 2017 -0700 @@ -24,8 +24,6 @@ # include <config.h> #endif -#include <boost/python.hpp> - #include <octave/oct.h> #include <octave/parse.h> @@ -123,7 +121,7 @@ { error ("pycall: error in argument type conversion"); } - catch (boost::python::error_already_set const &) + catch (pytave::error_already_set const &) { std::string message = pytave::fetch_exception_message (); error ("pycall: %s", message.c_str ());
--- a/pyeval.cc Wed May 03 20:32:10 2017 -0700 +++ b/pyeval.cc Wed May 03 21:48:07 2017 -0700 @@ -24,9 +24,6 @@ # include <config.h> #endif -#include <dlfcn.h> -#include <boost/python.hpp> - #include <oct.h> #include <octave/parse.h> @@ -95,7 +92,7 @@ { error ("pyexec: error in return value type conversion"); } - catch (boost::python::error_already_set const &) + catch (pytave::error_already_set const &) { std::string message = pytave::fetch_exception_message (); error ("pyeval: %s", message.c_str ());
--- a/pyexec.cc Wed May 03 20:32:10 2017 -0700 +++ b/pyexec.cc Wed May 03 21:48:07 2017 -0700 @@ -24,9 +24,6 @@ # include <config.h> #endif -#include <dlfcn.h> -#include <boost/python.hpp> - #include <oct.h> #include "exceptions.h" @@ -79,14 +76,13 @@ try { // FIXME: figure out exec return code: - // http://www.boost.org/doc/libs/1_38_0/libs/python/doc/v2/exec.html pytave::py_exec_string (code, 0, local_namespace); } catch (pytave::object_convert_exception const &) { error ("pyexec: error in return value type conversion"); } - catch (boost::python::error_already_set const &) + catch (pytave::error_already_set const &) { std::string message = pytave::fetch_exception_message (); error ("pyexec: %s", message.c_str ());