We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2733c4a commit dd67a9bCopy full SHA for dd67a9b
include/pybind11/detail/common.h
@@ -272,6 +272,19 @@ extern "C" {
272
} \
273
}
274
275
+#if PY_VERSION_HEX >= 0x03030000
276
+
277
+#define PYBIND11_CATCH_INIT_EXCEPTIONS \
278
+ catch (pybind11::error_already_set &e) { \
279
+ pybind11::raise_from(e, PyExc_ImportError, "initialization failed"); \
280
+ return nullptr; \
281
+ } catch (const std::exception &e) { \
282
+ PyErr_SetString(PyExc_ImportError, e.what()); \
283
284
+ } \
285
286
+#else
287
288
#define PYBIND11_CATCH_INIT_EXCEPTIONS \
289
catch (pybind11::error_already_set &e) { \
290
PyErr_SetString(PyExc_ImportError, e.what()); \
@@ -281,6 +294,8 @@ extern "C" {
294
return nullptr; \
295
296
297
+#endif
298
299
/** \rst
300
***Deprecated in favor of PYBIND11_MODULE***
301
0 commit comments