commit: 74d2509c99fbcb43e018ead4950b938e41e524e5 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Tue Nov 20 10:06:57 2018 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Tue Nov 20 10:24:12 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=74d2509c
compat_corouting._GeneratorTask: save throw return (bug 671472) According to PEP 342, the generator.throw() method returns a value if the exception is caught. The return value must be sent to the generator in order fufill the generator protocol. This is relevant in the portdbapi.async_xmatch() method, since it catches an exception thrown with the generator.throw() method. Bug: https://bugs.gentoo.org/671472 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/util/futures/compat_coroutine.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/portage/util/futures/compat_coroutine.py b/lib/portage/util/futures/compat_coroutine.py index b5ff92faf..b745fd845 100644 --- a/lib/portage/util/futures/compat_coroutine.py +++ b/lib/portage/util/futures/compat_coroutine.py @@ -106,13 +106,11 @@ class _GeneratorTask(object): if previous is None: future = next(self._generator) elif previous.cancelled(): - self._generator.throw(asyncio.CancelledError()) - future = next(self._generator) + future = self._generator.throw(asyncio.CancelledError()) elif previous.exception() is None: future = self._generator.send(previous.result()) else: - self._generator.throw(previous.exception()) - future = next(self._generator) + future = self._generator.throw(previous.exception()) except asyncio.CancelledError: self._result.cancel()