Skip to content

Commit 1914b7d

Browse files
Shorten PYBIND11_EMBEDDED_MODULE macro implementation by using PYBIND11_CATCH_INIT_EXCEPTIONS (#2579)
1 parent ae2e5a3 commit 1914b7d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

include/pybind11/embed.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,7 @@
5656
try { \
5757
PYBIND11_CONCAT(pybind11_init_, name)(m); \
5858
return m.ptr(); \
59-
} catch (::pybind11::error_already_set &e) { \
60-
PyErr_SetString(PyExc_ImportError, e.what()); \
61-
return nullptr; \
62-
} catch (const std::exception &e) { \
63-
PyErr_SetString(PyExc_ImportError, e.what()); \
64-
return nullptr; \
65-
} \
59+
} PYBIND11_CATCH_INIT_EXCEPTIONS \
6660
} \
6761
PYBIND11_EMBEDDED_MODULE_IMPL(name) \
6862
::pybind11::detail::embedded_module PYBIND11_CONCAT(pybind11_module_, name) \

0 commit comments

Comments
 (0)