()
| 924 | future = concurrent.futures.Future() |
| 925 | |
| 926 | def callback(): |
| 927 | try: |
| 928 | futures._chain_future(ensure_future(coro, loop=loop), future) |
| 929 | except (SystemExit, KeyboardInterrupt): |
| 930 | raise |
| 931 | except BaseException as exc: |
| 932 | if future.set_running_or_notify_cancel(): |
| 933 | future.set_exception(exc) |
| 934 | raise |
| 935 | |
| 936 | loop.call_soon_threadsafe(callback) |
| 937 | return future |