Skip to content

Commit 0be371d

Browse files
committed
Added cross-module exception test
[SVN r19282]
1 parent 2b52210 commit 0be371d

4 files changed

Lines changed: 64 additions & 0 deletions

File tree

test/Jamfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ run ../test/embedding.cpp <lib>../build/boost_python
6767
<$(gcc-compilers)><*><library-path>$(CYGWIN_PYTHON_DLL_PATH)
6868
<find-library>$(PYTHON_EMBEDDED_LIBRARY) ;
6969

70+
bpl-test crossmod_exception
71+
: crossmod_exception.py crossmod_exception_a.cpp crossmod_exception_b.cpp
72+
;
73+
7074
bpl-test return_arg ;
7175
bpl-test staticmethod ;
7276
bpl-test shared_ptr ;

test/crossmod_exception.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2003 Rational Discovery LLC
2+
# Permission to copy, use, modify, sell and distribute this software
3+
# is granted provided this copyright notice appears in all
4+
# copies. This software is provided "as is" without express or
5+
# implied warranty, and with no claim as to its suitability for any
6+
# purpose.
7+
import crossmod_exception_a
8+
import crossmod_exception_b
9+
10+
try:
11+
crossmod_exception_b.tossit()
12+
except IndexError:
13+
pass
14+
try:
15+
crossmod_exception_a.tossit()
16+
except IndexError:
17+
pass
18+
19+
20+

test/crossmod_exception_a.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (C) 2003 Rational Discovery LLC
2+
// Permission to copy, use, modify, sell and distribute this software
3+
// is granted provided this copyright notice appears in all
4+
// copies. This software is provided "as is" without express or
5+
// implied warranty, and with no claim as to its suitability for any
6+
// purpose.
7+
8+
#include <boost/python.hpp>
9+
10+
namespace python = boost::python;
11+
12+
void tossit(){
13+
PyErr_SetString(PyExc_IndexError,"a-blah!");
14+
throw python::error_already_set();
15+
}
16+
17+
BOOST_PYTHON_MODULE(crossmod_exception_a)
18+
{
19+
python::def("tossit",tossit);
20+
}

test/crossmod_exception_b.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (C) 2003 Rational Discovery LLC
2+
// Permission to copy, use, modify, sell and distribute this software
3+
// is granted provided this copyright notice appears in all
4+
// copies. This software is provided "as is" without express or
5+
// implied warranty, and with no claim as to its suitability for any
6+
// purpose.
7+
8+
#include <boost/python.hpp>
9+
10+
namespace python = boost::python;
11+
12+
void tossit(){
13+
PyErr_SetString(PyExc_IndexError,"b-blah!");
14+
throw python::error_already_set();
15+
}
16+
17+
BOOST_PYTHON_MODULE(crossmod_exception_b)
18+
{
19+
python::def("tossit",tossit);
20+
}

0 commit comments

Comments
 (0)