13 struct DoesNotSupportAsync {};
14 py::class_<DoesNotSupportAsync>(
m,
"DoesNotSupportAsync").def(py::init<>());
15 struct SupportsAsync {};
16 py::class_<SupportsAsync>(
m,
"SupportsAsync")
18 .def(
"__await__", [](
const SupportsAsync &
self) -> py::object {
19 static_cast<void>(
self);
20 py::object loop = py::module_::import(
"asyncio.events").attr(
"get_event_loop")();
21 py::object
f = loop.attr(
"create_future")();
22 f.attr(
"set_result")(5);
23 return f.attr(
"__await__")();