6 #include <pybind11/embed.h>
7 #include <pybind11/pybind11.h>
15 : theProcessPSet(), theMainModule(), theOwnsInterpreter(
true) {
16 pybind11::initialize_interpreter();
25 theOwnsInterpreter(
true)
28 pybind11::initialize_interpreter();
32 #if PY_MAJOR_VERSION >= 3
34 std::vector<WArgUPtr> v_argv;
35 std::vector<wchar_t*> vp_argv;
37 vp_argv.reserve(
argc);
38 for (
int i = 0;
i <
argc;
i++) {
39 v_argv.emplace_back(Py_DecodeLocale(
argv[
i],
nullptr), &PyMem_RawFree);
40 vp_argv.emplace_back(v_argv.back().get());
43 wchar_t** argvt = vp_argv.data();
48 PySys_SetArgv(
argc, argvt);
56 pybind11::finalize_interpreter();
75 }
catch (pybind11::error_already_set
const&
e) {
88 command +=
"\nprocess.fillProcessDesc(processPSet)";
89 pybind11::exec(
command.c_str());
97 std::ostringstream os;
104 return std::make_unique<edm::ProcessDesc>(
parameterSet());