commit:     7efa7ecfe07737239be593b2c32e497cc1d2f154
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  4 08:54:52 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan  4 08:57:09 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7efa7ecf

_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 <zmedico <AT> gentoo.org>

 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(

Reply via email to