diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 00:43:04 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-09 00:43:04 (GMT) |
commit | b551fac136940975e646ba8ed97dad455890bc3b (patch) | |
tree | b1dc7d469cd66b9cae35011c947353bd23db69ab /Lib/asyncio/tasks.py | |
parent | 25638d3109f6de1651fc8f39799b87d5347d59ad (diff) | |
parent | 3531d9044dbfd15b3bf5ec1abe5b9744fce37464 (diff) | |
download | cpython-b551fac136940975e646ba8ed97dad455890bc3b.zip cpython-b551fac136940975e646ba8ed97dad455890bc3b.tar.gz cpython-b551fac136940975e646ba8ed97dad455890bc3b.tar.bz2 |
Merge 3.4 (asyncio)
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r-- | Lib/asyncio/tasks.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 8fc5bea..7959a55 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -582,11 +582,12 @@ def gather(*coros_or_futures, loop=None, return_exceptions=False): def _done_callback(i, fut): nonlocal nfinished - if outer._state != futures._PENDING: - if fut._exception is not None: + if outer.done(): + if not fut.cancelled(): # Mark exception retrieved. fut.exception() return + if fut._state == futures._CANCELLED: res = futures.CancelledError() if not return_exceptions: @@ -644,9 +645,11 @@ def shield(arg, *, loop=None): def _done_callback(inner): if outer.cancelled(): - # Mark inner's result as retrieved. - inner.cancelled() or inner.exception() + if not inner.cancelled(): + # Mark inner's result as retrieved. + inner.exception() return + if inner.cancelled(): outer.cancel() else: |