Skip to content

miniproto.event_loop.run

run(main: Coroutine[Any, Any, T], *, debug: bool | None = None) -> T

Run one coroutine with an optimized asyncio.Runner when possible.

Parameters:

  • main (Coroutine[Any, Any, run[T]]) – The coroutine to execute until it returns or raises.
  • debug (bool | None) – Passed to asyncio.Runner. None preserves asyncio’s default; known backend/debug incompatibilities use the stdlib loop.

Returns:

  • run[T] – The coroutine’s result.

Raises:

  • BaseException – Any exception raised by main or backend setup.
Notes

The runner creates, closes, and clears its loop. It must not be called while another event loop is running in this thread.