mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
Split test_python_types.cpp into builtin_casters, stl and pytypes
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user