mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-46672: fix NameError
in asyncio.gather
if type check fails (GH-31187)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
e7130c2e8c
commit
4ab8167b9c
3 changed files with 17 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue