summaryrefslogtreecommitdiff
path: root/asyncio/tasks.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-16 18:50:01 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-07-16 18:50:01 +0200
commitf43e821a251b00ae88d7a7b1bfc55cbebb4f0fe3 (patch)
treee2b0919d7596781131908c5e310927981f799e4a /asyncio/tasks.py
parent0c18e36da4dd14bd3094f1112d75e3a11097d7b8 (diff)
downloadtrollius-f43e821a251b00ae88d7a7b1bfc55cbebb4f0fe3.tar.gz
Python issue 21163: Fix "destroy pending task" warning in test_wait_errors()
Diffstat (limited to 'asyncio/tasks.py')
-rw-r--r--asyncio/tasks.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/asyncio/tasks.py b/asyncio/tasks.py
index a741bd3..07952c9 100644
--- a/asyncio/tasks.py
+++ b/asyncio/tasks.py
@@ -330,14 +330,14 @@ def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED):
raise TypeError("expect a list of futures, not %s" % type(fs).__name__)
if not fs:
raise ValueError('Set of coroutines/Futures is empty.')
+ if return_when not in (FIRST_COMPLETED, FIRST_EXCEPTION, ALL_COMPLETED):
+ raise ValueError('Invalid return_when value: {}'.format(return_when))
if loop is None:
loop = events.get_event_loop()
fs = {async(f, loop=loop) for f in set(fs)}
- if return_when not in (FIRST_COMPLETED, FIRST_EXCEPTION, ALL_COMPLETED):
- raise ValueError('Invalid return_when value: {}'.format(return_when))
return (yield from _wait(fs, timeout, return_when, loop))