summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-02-20 15:28:42 (GMT)
committerGitHub <noreply@github.com>2022-02-20 15:28:42 (GMT)
commitf1916cde24053f4c8b6799730666d19474f8dd09 (patch)
treead1ddb5fe008f435f2f7fdd3153c3e8a9eb5075b /Lib/asyncio/tasks.py
parentfa621a738875dc8a644a6149e7ffd4be0a40f1d9 (diff)
downloadcpython-f1916cde24053f4c8b6799730666d19474f8dd09.zip
cpython-f1916cde24053f4c8b6799730666d19474f8dd09.tar.gz
cpython-f1916cde24053f4c8b6799730666d19474f8dd09.tar.bz2
bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187) (GH-31440)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> (cherry picked from commit 4ab8167b9c60d1a04b2e3116d0c52db254b68cda) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r--Lib/asyncio/tasks.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index 2bee5c0..c4bedb5 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -721,7 +721,7 @@ def gather(*coros_or_futures, return_exceptions=False):
nonlocal nfinished
nfinished += 1
- if outer.done():
+ if outer is None or outer.done():
if not fut.cancelled():
# Mark exception retrieved.
fut.exception()
@@ -777,6 +777,7 @@ def gather(*coros_or_futures, return_exceptions=False):
nfuts = 0
nfinished = 0
loop = None
+ outer = None # bpo-46672
for arg in coros_or_futures:
if arg not in arg_to_fut:
fut = _ensure_future(arg, loop=loop)