MCPcopy Create free account
hub / github.com/boostorg/cobalt / python_executor

Method python_executor

example/python.cpp:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32struct python_executor
33{
34 python_executor(py::object loop = ::get_loop()) noexcept
35 : m_ptr(loop.ptr())
36 {
37 // the asio::execution_context needs to present, we put it into the event loop.
38 if (!py::hasattr(loop, "__asio_execution_context"))
39 {
40 auto ptr = std::make_unique<asio::execution_context>();
41 context_ = ptr.get();
42 py::setattr(loop, "__asio_execution_context",
43 py::cast(std::move(ptr)));
44 }
45 else
46 context_ = py::cast<std::unique_ptr<asio::execution_context>&>(
47 py::getattr(loop, "__asio_execution_context")
48 ).get();
49 }
50
51 asio::execution_context &query(asio::execution::context_t) const
52 {

Callers

nothing calls this directly

Calls 2

get_loopFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected