From 1914b7d3a741cccb24ab9825fb0574e38b63d282 Mon Sep 17 00:00:00 2001 From: Yannick Jadoul Date: Mon, 12 Oct 2020 23:10:18 +0200 Subject: [PATCH] Shorten PYBIND11_EMBEDDED_MODULE macro implementation by using PYBIND11_CATCH_INIT_EXCEPTIONS (#2579) --- include/pybind11/embed.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/pybind11/embed.h b/include/pybind11/embed.h index aebf6b23c..204aaf989 100644 --- a/include/pybind11/embed.h +++ b/include/pybind11/embed.h @@ -56,13 +56,7 @@ try { \ PYBIND11_CONCAT(pybind11_init_, name)(m); \ return m.ptr(); \ - } catch (::pybind11::error_already_set &e) { \ - PyErr_SetString(PyExc_ImportError, e.what()); \ - return nullptr; \ - } catch (const std::exception &e) { \ - PyErr_SetString(PyExc_ImportError, e.what()); \ - return nullptr; \ - } \ + } PYBIND11_CATCH_INIT_EXCEPTIONS \ } \ PYBIND11_EMBEDDED_MODULE_IMPL(name) \ ::pybind11::detail::embedded_module PYBIND11_CONCAT(pybind11_module_, name) \