diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-16 16:50:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-16 16:50:39 (GMT) |
commit | e931f7b768efd3314a4936d9198f28548179ace6 (patch) | |
tree | 4f1a96dd7e74da817eae8d26d3426c7d64084ea5 /Lib/asyncio | |
parent | f03b3c75647219110924197bb26e83dd69f826f5 (diff) | |
download | cpython-e931f7b768efd3314a4936d9198f28548179ace6.zip cpython-e931f7b768efd3314a4936d9198f28548179ace6.tar.gz cpython-e931f7b768efd3314a4936d9198f28548179ace6.tar.bz2 |
Issue #21163: Fix "destroy pending task" warning in test_wait_errors()
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/tasks.py | 4 |
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)) |