Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use BOOST_NOEXCEPT_OR_NOTHROW #468

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions include/boost/python/instance_holder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# include <boost/python/detail/prefix.hpp>

# include <boost/config.hpp>
# include <boost/noncopyable.hpp>
# include <boost/python/type_id.hpp>
# include <cstddef>
Expand All @@ -31,7 +32,7 @@ struct BOOST_PYTHON_DECL instance_holder : private noncopyable
// that always holds the Python object.
virtual void* holds(type_info, bool null_ptr_only) = 0;

void install(PyObject* inst) throw();
void install(PyObject* inst) BOOST_NOEXCEPT_OR_NOTHROW;

// These functions should probably be located elsewhere.

Expand All @@ -42,7 +43,7 @@ struct BOOST_PYTHON_DECL instance_holder : private noncopyable

// Deallocate storage from the heap if it was not carved out of
// the given Python object by allocate(), above.
static void deallocate(PyObject*, void* storage) throw();
static void deallocate(PyObject*, void* storage) BOOST_NOEXCEPT_OR_NOTHROW;
private:
instance_holder* m_next;
};
Expand Down
5 changes: 3 additions & 2 deletions src/object/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/python/detail/prefix.hpp>
#include <boost/config.hpp>
#include <boost/mpl/lambda.hpp> // #including this first is an intel6 workaround
#include <boost/cstdint.hpp>

Expand Down Expand Up @@ -302,7 +303,7 @@ static PyTypeObject class_metatype_object = {

// Install the instance data for a C++ object into a Python instance
// object.
void instance_holder::install(PyObject* self) throw()
void instance_holder::install(PyObject* self) BOOST_NOEXCEPT_OR_NOTHROW
{
assert(PyType_IsSubtype(Py_TYPE(Py_TYPE(self)), &class_metatype_object));
m_next = ((objects::instance<>*)self)->objects;
Expand Down Expand Up @@ -779,7 +780,7 @@ void* instance_holder::allocate(PyObject* self_, std::size_t holder_offset, std:
}
}

void instance_holder::deallocate(PyObject* self_, void* storage) throw()
void instance_holder::deallocate(PyObject* self_, void* storage) BOOST_NOEXCEPT_OR_NOTHROW
{
assert(PyType_IsSubtype(Py_TYPE(Py_TYPE(self_)), &class_metatype_object));
objects::instance<>* self = (objects::instance<>*)self_;
Expand Down
6 changes: 4 additions & 2 deletions test/module_tail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ extern "C" void (*old_translator)(unsigned, EXCEPTION_POINTERS*)
#include <exception>
#include <boost/python/extract.hpp>
#include <boost/python/str.hpp>
#include <boost/config.hpp>

struct test_failure : std::exception
{
test_failure(char const* expr, char const* /*function*/, char const* file, unsigned line)
: msg(file + boost::python::str(":%s:") % line + ": Boost.Python assertion failure: " + expr)
{}

~test_failure() throw() {}
~test_failure() BOOST_NOEXCEPT_OR_NOTHROW {}

char const* what() const throw()
char const* what() const BOOST_NOEXCEPT_OR_NOTHROW
{
return boost::python::extract<char const*>(msg)();
}
Expand Down