commit: 21aea3df73497184c5c94fd6c69ebe23f3d214e9 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Mon Mar 23 00:19:27 2020 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Mon Mar 23 00:41:36 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=21aea3df
AsynchronousTask: in _async_wait, call self.wait() immediately In _async_wait, call self.wait() immediately so that the stack trace for an InvalidStateError will contain useful debugging information. Since commit 46903f3e5622, exit listeners are invoked via call_soon, so it's no longer unecessary for _async_wait to invoke self.wait() via call_soon. Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/_emerge/AsynchronousTask.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index aaab7433a..c4197d468 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -109,13 +109,13 @@ class AsynchronousTask(SlotObject): def _async_wait(self): """ - For cases where _start exits synchronously, this method is a - convenient way to trigger an asynchronous call to self.wait() - (in order to notify exit listeners), avoiding excessive event - loop recursion (or stack overflow) that synchronous calling of - exit listeners can cause. This method is thread-safe. + Subclasses call this method in order to invoke exit listeners when + self.returncode is set. Subclasses may override this method in order + to perform cleanup. The default implementation for this method simply + calls self.wait(), which will immediately raise an InvalidStateError + if the event loop is running and self.returncode is None. """ - self.scheduler.call_soon(self.wait) + self.wait() def cancel(self): """