6 #include <pybind11/embed.h>
7 #include <pybind11/pybind11.h>
16 : theProcessPSet(), theMainModule(), theOwnsInterpreter(
true) {
17 pybind11::initialize_interpreter();
26 theOwnsInterpreter(
true)
29 pybind11::initialize_interpreter();
33 #if PY_MAJOR_VERSION >= 3
35 std::vector<WArgUPtr> v_argv;
36 std::vector<wchar_t*> vp_argv;
38 vp_argv.reserve(
argc);
39 for (
int i = 0;
i <
argc;
i++) {
40 v_argv.emplace_back(Py_DecodeLocale(
argv[
i],
nullptr), &PyMem_RawFree);
41 vp_argv.emplace_back(v_argv.back().get());
44 wchar_t** argvt = vp_argv.data();
49 PySys_SetArgv(
argc, argvt);
57 pybind11::finalize_interpreter();
76 }
catch (pybind11::error_already_set
const&
e) {
89 command +=
"\nprocess.fillProcessDesc(processPSet)";
90 pybind11::exec(
command.c_str());
98 std::ostringstream os;
105 return std::make_unique<edm::ProcessDesc>(
parameterSet());