2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-25 18:32:24 +00:00

fixes for GCC .so/exception problems

[SVN r13471]
This commit is contained in:
Dave Abrahams
2002-04-13 04:23:41 +00:00
parent 5fbba7bc01
commit 9a140643c8
23 changed files with 144 additions and 93 deletions

View File

@@ -77,7 +77,7 @@ BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE
if (tup.size() != 3) {
PyErr_SetString(PyExc_ValueError,
"expecting exactly 3 values in tuple.");
throw python::error_already_set();
python::throw_error_already_set();
}
MillerIndex result;
for (int i = 0; i < 3; i++)

View File

@@ -63,7 +63,7 @@ namespace { // Avoid cluttering the global namespace.
if (state.size() != 1) {
PyErr_SetString(PyExc_ValueError,
"Unexpected argument in call to __setstate__.");
throw python::error_already_set();
python::throw_error_already_set();
}
int number = from_python(state[0].get(), python::type<int>());
if (number != 42)

View File

@@ -99,7 +99,7 @@ namespace {
{
if(args.size() != 1 || keywords.size() != 0) {
PyErr_SetString(PyExc_TypeError, "wrong number of arguments");
throw boost::python::error_already_set();
boost::python::throw_error_already_set();
}
const world& w = from_python(args[0].get(), type<const world&>());
ref mydict = getattr(args[0], "__dict__");
@@ -115,7 +115,7 @@ namespace {
{
if(args.size() != 2 || keywords.size() != 0) {
PyErr_SetString(PyExc_TypeError, "wrong number of arguments");
throw boost::python::error_already_set();
boost::python::throw_error_already_set();
}
world& w = from_python(args[0].get(), type<world&>());
ref mydict = getattr(args[0], "__dict__");
@@ -123,7 +123,7 @@ namespace {
if (state.size() != 2) {
PyErr_SetString(PyExc_ValueError,
"Unexpected argument in call to __setstate__.");
throw python::error_already_set();
python::throw_error_already_set();
}
// restore the object's __dict__
dictionary odict = from_python(mydict.get(), type<dictionary>());

View File

@@ -35,7 +35,7 @@ namespace vects {
{ \
if (lhs.size() != rhs.size()) { \
PyErr_SetString(PyExc_ValueError, "vectors have different sizes"); \
throw boost::python::error_already_set(); \
boost::python::throw_error_already_set(); \
} \
std::vector<bool> result(lhs.size()); \
for (std::size_t i=0; i<lhs.size(); i++) { \

View File

@@ -12,7 +12,7 @@ namespace vects { \
operator##oper (const vect_type1& lhs, const vect_type2& rhs) { \
if (lhs.size() != rhs.size()) { \
PyErr_SetString(PyExc_ValueError, "vectors have different sizes"); \
throw boost::python::error_already_set(); \
boost::python::throw_error_already_set(); \
} \
result_type result(lhs.size()); \
for (std::size_t i=0; i<lhs.size(); i++) { \

View File

@@ -32,7 +32,7 @@ namespace { // Avoid cluttering the global namespace.
void raise_vector_IndexError() {
PyErr_SetString(PyExc_IndexError, "vector index out of range");
throw python::error_already_set();
python::throw_error_already_set();
}
double getitem(const std::vector<double>& vd, std::size_t key) {
@@ -90,8 +90,8 @@ BOOST_PYTHON_MODULE_INIT(simple_vector)
python::class_builder<std::vector<double>, vector_double_wrapper>
vector_double(this_module, "vector_double");
vector_double.def(python::constructor<>());
vector_double.def(python::constructor<int>());
vector_double.def(python::constructor<>());
vector_double.def(python::constructor<python::tuple>());
vector_double.def(&std::vector<double>::size, "__len__");
vector_double.def(getitem, "__getitem__");

View File

@@ -39,7 +39,7 @@ namespace example {
void raise_vector_IndexError() {
PyErr_SetString(PyExc_IndexError, "vector index out of range");
throw boost::python::error_already_set();
boost::python::throw_error_already_set();
}
template <typename T>