From 77f5eb703ce76716e0882655d013ed5ca82b8fc6 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 23 Jul 2003 03:00:48 +0000 Subject: [PATCH] Attempt to work around a GCC EH problem by sticking a virtual function in error_already_set and defining it in the library. Removed some flotsam [SVN r19274] --- include/boost/python/errors.hpp | 7 ++++--- src/errors.cpp | 19 ++----------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/include/boost/python/errors.hpp b/include/boost/python/errors.hpp index 4695a601..424baf71 100644 --- a/include/boost/python/errors.hpp +++ b/include/boost/python/errors.hpp @@ -14,8 +14,10 @@ namespace boost { namespace python { -struct BOOST_PYTHON_DECL error_already_set {}; -struct BOOST_PYTHON_DECL argument_error : error_already_set {}; +struct BOOST_PYTHON_DECL error_already_set +{ + virtual ~error_already_set(); +}; // Handles exceptions caught just before returning to Python code. // Returns true iff an exception was caught. @@ -34,7 +36,6 @@ inline void handle_exception() handle_exception(detail::rethrow); } -BOOST_PYTHON_DECL void throw_argument_error(); BOOST_PYTHON_DECL void throw_error_already_set(); template diff --git a/src/errors.cpp b/src/errors.cpp index 8cda9f0e..6a23fc9a 100644 --- a/src/errors.cpp +++ b/src/errors.cpp @@ -14,6 +14,8 @@ namespace boost { namespace python { +error_already_set::~error_already_set() {} + // IMPORTANT: this function may only be called from within a catch block! BOOST_PYTHON_DECL bool handle_exception_impl(function0 f) { @@ -47,11 +49,6 @@ BOOST_PYTHON_DECL bool handle_exception_impl(function0 f) return true; } -void BOOST_PYTHON_DECL throw_argument_error() -{ - throw argument_error(); -} - void BOOST_PYTHON_DECL throw_error_already_set() { throw error_already_set(); @@ -59,18 +56,6 @@ void BOOST_PYTHON_DECL throw_error_already_set() namespace detail { - BOOST_PYTHON_DECL void expect_complex(PyObject* p) - { - if (!PyComplex_Check(p)) - { - PyErr_SetString(PyExc_TypeError, "expected a complex number"); - boost::python::throw_argument_error(); - } - } - -// needed by void_adaptor (see void_adaptor.hpp) -BOOST_PYTHON_DECL PyObject arbitrary_object = { 0 }; - bool exception_handler::operator()(function0 const& f) const { if (m_next)