Skip to content

Commit f7254f5

Browse files
db4stefanseefeld
authored andcommitted
Add a test case for issue #280
1 parent bffcb99 commit f7254f5

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

test/fabscript

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ for t in [('injected',),
6767
('args',),
6868
('raw_ctor',),
6969
('exception_translator',),
70+
('module_init_exception',),
7071
('test_enum', ['enum_ext']),
7172
('test_cltree', ['cltree']),
7273
('newtest', ['m1', 'm2']),

test/module_init_exception.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (C) 2003 Rational Discovery LLC
2+
// Distributed under the Boost Software License, Version 1.0. (See
3+
// accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#include <boost/python/module.hpp>
7+
#include <stdexcept>
8+
9+
using namespace boost::python;
10+
11+
BOOST_PYTHON_MODULE(module_init_exception_ext)
12+
{
13+
throw std::runtime_error("Module init failed");
14+
}

test/module_init_exception.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (C) 2003 Rational Discovery LLC. Distributed under the Boost
2+
# Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
3+
# at http://www.boost.org/LICENSE_1_0.txt)
4+
5+
print("running...")
6+
7+
try:
8+
import module_init_exception_ext
9+
except RuntimeError as e:
10+
print(e)
11+
12+
print("Done.")

0 commit comments

Comments
 (0)