(awaitable: Awaitable)
| 857 | |
| 858 | |
| 859 | def _wrap_awaitable(awaitable: Awaitable) -> Future: |
| 860 | # Convert Awaitables into Futures. |
| 861 | # Note that we use ensure_future, which handles both awaitables |
| 862 | # and coroutines, rather than create_task, which only accepts |
| 863 | # coroutines. (ensure_future calls create_task if given a coroutine) |
| 864 | fut = asyncio.ensure_future(awaitable) |
| 865 | # See comments on IOLoop._pending_tasks. |
| 866 | loop = IOLoop.current() |
| 867 | loop._register_task(fut) |
| 868 | fut.add_done_callback(lambda f: loop._unregister_task(f)) |
| 869 | return fut |
| 870 | |
| 871 | |
| 872 | def convert_yielded(yielded: _Yieldable) -> Future: |
no test coverage detected