| 41 | } |
| 42 | |
| 43 | void PythonScriptEngine::eval(const std::string &script) { |
| 44 | py::gil_scoped_acquire gil { }; |
| 45 | try { |
| 46 | if (script[0] == '\n') { |
| 47 | py::eval<py::eval_statements>(py::module::import("textwrap").attr("dedent")(script), *bindings_, *bindings_); |
| 48 | } else { |
| 49 | py::eval<py::eval_statements>(script, *bindings_, *bindings_); |
| 50 | } |
| 51 | } catch (std::exception& e) { |
| 52 | throw minifi::script::ScriptException(e.what()); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | void PythonScriptEngine::evalFile(const std::string &file_name) { |
| 57 | py::gil_scoped_acquire gil { }; |
no test coverage detected