From 7efa7ecfe07737239be593b2c32e497cc1d2f154 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 4 Jan 2021 00:54:52 -0800 Subject: _Retry: Use ensure_future for self._current_task Use ensure_future for compatibility with PEP 492 coroutines with async and await syntax. Signed-off-by: Zac Medico --- lib/portage/util/futures/retry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/util/futures/retry.py b/lib/portage/util/futures/retry.py index 4092f60d6..31cc161da 100644 --- a/lib/portage/util/futures/retry.py +++ b/lib/portage/util/futures/retry.py @@ -1,4 +1,4 @@ -# Copyright 2018 Gentoo Foundation +# Copyright 2018-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ( @@ -113,7 +113,7 @@ class _Retry: def _begin_try(self): self._tries += 1 - self._current_task = self._func() + self._current_task = asyncio.ensure_future(self._func(), loop=self._loop) self._current_task.add_done_callback(self._try_done) if self._try_timeout is not None: self._try_timeout_handle = self._loop.call_later( -- cgit v1.2.3-65-gdbad