Class Dune::PybindXI::ScopedInterpreter¶
-
class Dune::PybindXI::ScopedInterpreter¶
Gives access to a Python interpreter, embedding one if the process does not already run one.
Note
Most likely, you do not want to use this class directly, but GlobalInterpreter() instead!
Note
All members require the GIL and acquire it themselves. Any pybind11 object obtained from here must also be destroyed while holding the GIL; use pybind11::gil_scoped_acquire in the calling scope if you keep one alive beyond a single call.
Method Dune::PybindXI::ScopedInterpreter::import_module¶
-
pybind11::module Dune::PybindXI::ScopedInterpreter::import_module(const std::string &module_name)¶
No documentation provided.
Constructor Dune::PybindXI::ScopedInterpreter::ScopedInterpreter¶
-
Dune::PybindXI::ScopedInterpreter::ScopedInterpreter()¶
Embeds an interpreter, unless the process already runs one (in which case that one is used).
Field Dune::PybindXI::ScopedInterpreter::interpreter_¶
-
std::optional<pybind11::scoped_interpreter> Dune::PybindXI::ScopedInterpreter::interpreter_¶
Only engaged if we embedded the interpreter ourselves. Finalizing an interpreter we do not own (i.e. when we are called from Python) would tear down the caller’s process, hence the optional.