Split test_python_types.cpp into builtin_casters, stl and pytypes

This commit is contained in:
Dean Moldovan
2017-06-09 00:44:49 +02:00
parent bdfb50f384
commit 83e328f58c
22 changed files with 1276 additions and 1442 deletions

View File

@@ -108,6 +108,10 @@ struct PythonCallInDestructor {
};
test_initializer custom_exceptions([](py::module &m) {
m.def("throw_std_exception", []() {
throw std::runtime_error("This exception was intentionally thrown.");
});
// make a new custom exception and use it as a translation target
static py::exception<MyException> ex(m, "MyException");
py::register_exception_translator([](std::exception_ptr p) {