summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@dropbox.com>2015-10-05 23:26:00 (GMT)
committerGuido van Rossum <guido@dropbox.com>2015-10-05 23:26:00 (GMT)
commit8ab4169f5a267d6942aebf377a4756ea3ddab17b (patch)
tree529ed07e8494b5d46e7b41e39fbf20606a7b0ab0 /Lib/asyncio/tasks.py
parentf536386ca95ccd2f6798435887ffb0a137d8359e (diff)
parent5db034acfaa79447cb5c310f6ad7071737474027 (diff)
downloadcpython-8ab4169f5a267d6942aebf377a4756ea3ddab17b.zip
cpython-8ab4169f5a267d6942aebf377a4756ea3ddab17b.tar.gz
cpython-8ab4169f5a267d6942aebf377a4756ea3ddab17b.tar.bz2
Docs and one small improvement for issue #25304, by Vincent Michel. (Merge 3.5->3.6.)
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r--Lib/asyncio/tasks.py7
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