diff options
author | Zac Medico <zmedico@gentoo.org> | 2018-11-20 02:06:57 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2018-11-20 02:24:12 -0800 |
commit | 74d2509c99fbcb43e018ead4950b938e41e524e5 (patch) | |
tree | fa9c6fc3e132d09e51bb0204d9f8fdd0098f04cb /lib | |
parent | etc-update: manjaro now uses arch ID_LIKE (diff) | |
download | portage-74d2509c99fbcb43e018ead4950b938e41e524e5.tar.gz portage-74d2509c99fbcb43e018ead4950b938e41e524e5.tar.bz2 portage-74d2509c99fbcb43e018ead4950b938e41e524e5.zip |
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@gentoo.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/portage/util/futures/compat_coroutine.py | 6 |
1 files 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() |