diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2022-02-20 10:24:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-20 10:24:00 (GMT) |
commit | 4ab8167b9c60d1a04b2e3116d0c52db254b68cda (patch) | |
tree | f7c1e79ff0941bfd8deca5e6dfccc0d527f87d8d /Lib/asyncio/tasks.py | |
parent | e7130c2e8c6abfaf04b209bd5b239059eda024b9 (diff) | |
download | cpython-4ab8167b9c60d1a04b2e3116d0c52db254b68cda.zip cpython-4ab8167b9c60d1a04b2e3116d0c52db254b68cda.tar.gz cpython-4ab8167b9c60d1a04b2e3116d0c52db254b68cda.tar.bz2 |
bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
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 c11d0da..25a650f 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -735,7 +735,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() @@ -791,6 +791,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) |