From 21aea3df73497184c5c94fd6c69ebe23f3d214e9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 22 Mar 2020 17:19:27 -0700 Subject: 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 --- lib/_emerge/AsynchronousTask.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') 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): """ -- cgit v1.2.3