diff options
author | Guido van Rossum <guido@python.org> | 2015-10-05 23:20:00 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2015-10-05 23:20:00 (GMT) |
commit | 601953b67958572162d0ab7d3f24c07340ad9dbb (patch) | |
tree | 7341a077fa62b61dd3916b405b19fd74a926ffe4 /Lib/asyncio/tasks.py | |
parent | b9bf913ab32d27d221fb765fd90d64d07e926000 (diff) | |
download | cpython-601953b67958572162d0ab7d3f24c07340ad9dbb.zip cpython-601953b67958572162d0ab7d3f24c07340ad9dbb.tar.gz cpython-601953b67958572162d0ab7d3f24c07340ad9dbb.tar.bz2 |
Docs and one small improvement for issue #25304, by Vincent Michel.
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r-- | Lib/asyncio/tasks.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 5a7bd9d..b887d88 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -704,7 +704,12 @@ def run_coroutine_threadsafe(coro, loop): future = concurrent.futures.Future() def callback(): - futures._chain_future(ensure_future(coro, loop=loop), future) + try: + futures._chain_future(ensure_future(coro, loop=loop), future) + except Exception as exc: + if future.set_running_or_notify_cancel(): + future.set_exception(exc) + raise loop.call_soon_threadsafe(callback) return future |