2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

Added cross-module exception test

[SVN r19282]
This commit is contained in:
Dave Abrahams
2003-07-23 15:17:03 +00:00
parent 2b52210291
commit 0be371d747
4 changed files with 64 additions and 0 deletions

View File

@@ -67,6 +67,10 @@ run ../test/embedding.cpp <lib>../build/boost_python
<$(gcc-compilers)><*><library-path>$(CYGWIN_PYTHON_DLL_PATH)
<find-library>$(PYTHON_EMBEDDED_LIBRARY) ;
bpl-test crossmod_exception
: crossmod_exception.py crossmod_exception_a.cpp crossmod_exception_b.cpp
;
bpl-test return_arg ;
bpl-test staticmethod ;
bpl-test shared_ptr ;

View File

@@ -0,0 +1,20 @@
# Copyright (C) 2003 Rational Discovery LLC
# Permission to copy, use, modify, sell and distribute this software
# is granted provided this copyright notice appears in all
# copies. This software is provided "as is" without express or
# implied warranty, and with no claim as to its suitability for any
# purpose.
import crossmod_exception_a
import crossmod_exception_b
try:
crossmod_exception_b.tossit()
except IndexError:
pass
try:
crossmod_exception_a.tossit()
except IndexError:
pass

20
test/crossmod_exception_a.cpp Executable file
View File

@@ -0,0 +1,20 @@
// Copyright (C) 2003 Rational Discovery LLC
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all
// copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any
// purpose.
#include <boost/python.hpp>
namespace python = boost::python;
void tossit(){
PyErr_SetString(PyExc_IndexError,"a-blah!");
throw python::error_already_set();
}
BOOST_PYTHON_MODULE(crossmod_exception_a)
{
python::def("tossit",tossit);
}

20
test/crossmod_exception_b.cpp Executable file
View File

@@ -0,0 +1,20 @@
// Copyright (C) 2003 Rational Discovery LLC
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all
// copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any
// purpose.
#include <boost/python.hpp>
namespace python = boost::python;
void tossit(){
PyErr_SetString(PyExc_IndexError,"b-blah!");
throw python::error_already_set();
}
BOOST_PYTHON_MODULE(crossmod_exception_b)
{
python::def("tossit",tossit);
}