We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b0dad5 commit 380c3d1Copy full SHA for 380c3d1
include/pybind11/embed.h
@@ -157,12 +157,13 @@ inline void initialize_interpreter(bool init_signal_handlers = true,
157
// A failure here indicates a character-encoding failure or the python
158
// interpreter out of memory. Give up.
159
PyConfig_Clear(&config);
160
- throw std::runtime_error("Failed to prepare CPython");
+ throw std::runtime_error(PyStatus_IsError() ? status.err_msg
161
+ : "Failed to prepare CPython");
162
}
163
status = Py_InitializeFromConfig(&config);
164
165
if (PyStatus_Exception(status)) {
- throw std::runtime_error("Failed to init CPython");
166
+ throw std::runtime_error(PyStatus_IsError() ? status.err_msg : "Failed to init CPython");
167
168
if (add_program_dir_to_path) {
169
PyRun_SimpleString("import sys, os.path; "
0 commit comments