Skip to content

Commit 6010f5b

Browse files
committed
Temporary workaround for PYBIND11_CATCH_INIT_EXCEPTIONS issue that exists already on master (see PR #3965).
1 parent fdab517 commit 6010f5b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/pybind11/detail/common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@
324324

325325
#define PYBIND11_CATCH_INIT_EXCEPTIONS \
326326
catch (pybind11::error_already_set &) { \
327-
pybind11::raise_from(PyExc_ImportError, "initialization failed"); \
327+
std::string err_str = py::detail::error_string(); \
328+
PyErr_Clear(); \
329+
PyErr_SetString(PyExc_ImportError, err_str.c_str()); \
328330
return nullptr; \
329331
} \
330332
catch (const std::exception &e) { \

0 commit comments

Comments
 (0)