summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/tasks.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-16 16:50:54 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-16 16:50:54 (GMT)
commitf85581f6e58d7a77cfca06a72de1812fcda8e795 (patch)
tree7f62a37e4b15b43580da8c4c4b698b0af9586ea8 /Lib/asyncio/tasks.py
parent845212af414712e7d9c97e17cc9b970e54859869 (diff)
parente931f7b768efd3314a4936d9198f28548179ace6 (diff)
downloadcpython-f85581f6e58d7a77cfca06a72de1812fcda8e795.zip
cpython-f85581f6e58d7a77cfca06a72de1812fcda8e795.tar.gz
cpython-f85581f6e58d7a77cfca06a72de1812fcda8e795.tar.bz2
(Merge 3.4) Issue #21163: Fix "destroy pending task" warning in test_wait_errors()
Diffstat (limited to 'Lib/asyncio/tasks.py')
-rw-r--r--Lib/asyncio/tasks.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index a741bd3..07952c9 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/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))