summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/base_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2017-12-19 12:19:53 (GMT)
committerGitHub <noreply@github.com>2017-12-19 12:19:53 (GMT)
commit36c2c044782997520df7fc5604742a615ccf6b17 (patch)
treee7ea59b96168eaad588a613943a9a47d3d2aa394 /Lib/asyncio/base_events.py
parenta9d7e552c72b6e9515e76a1dd4b247da86da23de (diff)
downloadcpython-36c2c044782997520df7fc5604742a615ccf6b17.zip
cpython-36c2c044782997520df7fc5604742a615ccf6b17.tar.gz
cpython-36c2c044782997520df7fc5604742a615ccf6b17.tar.bz2
bpo-32355: Optimize asyncio.gather() (#4913)
Diffstat (limited to 'Lib/asyncio/base_events.py')
-rw-r--r--Lib/asyncio/base_events.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index bd5bb32..a7f8edd 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -139,11 +139,12 @@ def _ipaddr_info(host, port, family, type, proto):
def _run_until_complete_cb(fut):
- exc = fut._exception
- if isinstance(exc, BaseException) and not isinstance(exc, Exception):
- # Issue #22429: run_forever() already finished, no need to
- # stop it.
- return
+ if not fut.cancelled():
+ exc = fut.exception()
+ if isinstance(exc, BaseException) and not isinstance(exc, Exception):
+ # Issue #22429: run_forever() already finished, no need to
+ # stop it.
+ return
fut._loop.stop()