diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-02-20 15:28:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-20 15:28:42 (GMT) |
commit | f1916cde24053f4c8b6799730666d19474f8dd09 (patch) | |
tree | ad1ddb5fe008f435f2f7fdd3153c3e8a9eb5075b /Lib/asyncio/tasks.py | |
parent | fa621a738875dc8a644a6149e7ffd4be0a40f1d9 (diff) | |
download | cpython-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.py | 3 |
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) |