# HG changeset patch # User Mike Miller # Date 1493873287 25200 # Node ID 9bf8ba050122141132feb07e81754fc66389885f # Parent ee6afd27a78c3e589882f0bf9e7150524ec4fb60 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. diff -r ee6afd27a78c -r 9bf8ba050122 __py_struct_from_dict__.cc --- 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 - 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 ()); diff -r ee6afd27a78c -r 9bf8ba050122 exceptions.h --- 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); } diff -r ee6afd27a78c -r 9bf8ba050122 oct-py-eval.cc --- 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 -#include #include #include +#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 (); } diff -r ee6afd27a78c -r 9bf8ba050122 oct-py-types.cc --- 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 - 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; diff -r ee6afd27a78c -r 9bf8ba050122 oct-py-util.cc --- 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 #include +#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 - namespace pytave { @@ -173,7 +171,7 @@ } if (! dict) - throw boost::python::error_already_set (); + throw pytave::error_already_set (); objstore = dict; } diff -r ee6afd27a78c -r 9bf8ba050122 pycall.cc --- 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 #endif -#include - #include #include @@ -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 ()); diff -r ee6afd27a78c -r 9bf8ba050122 pyeval.cc --- 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 #endif -#include -#include - #include #include @@ -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 ()); diff -r ee6afd27a78c -r 9bf8ba050122 pyexec.cc --- 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 #endif -#include -#include - #include #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 ());