diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-05-03 15:35:26 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-05-03 15:35:25 (GMT) |
commit | 4737b923df6fbdb9e2bf3fdccea2112270556e0a (patch) | |
tree | 7e2d59f6e40479a713796953928f897463cf1c86 /Lib/asyncio/tasks.py | |
parent | ceb842e155f5fa0109fa88d52da3d1f5e73490ad (diff) | |
download | cpython-4737b923df6fbdb9e2bf3fdccea2112270556e0a.zip cpython-4737b923df6fbdb9e2bf3fdccea2112270556e0a.tar.gz cpython-4737b923df6fbdb9e2bf3fdccea2112270556e0a.tar.bz2 |
bpo-24638: Improve the error message in asyncio.ensure_future() (#12848)
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 007a459..b007b74 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -628,7 +628,8 @@ def ensure_future(coro_or_future, *, loop=None): return task elif futures.isfuture(coro_or_future): if loop is not None and loop is not futures._get_loop(coro_or_future): - raise ValueError('loop argument must agree with Future') + raise ValueError('The future belongs to a different loop than ' + 'the one specified as the loop argument') return coro_or_future elif inspect.isawaitable(coro_or_future): return ensure_future(_wrap_awaitable(coro_or_future), loop=loop) |