QueueScheduler: fix for IpcDaemonTestCase
authorZac Medico <zmedico@gentoo.org>
Thu, 9 Feb 2012 08:21:24 +0000 (00:21 -0800)
committerZac Medico <zmedico@gentoo.org>
Thu, 9 Feb 2012 08:21:24 +0000 (00:21 -0800)
Use a StopIteration exception to jump out of EventLoop.iterate()
before the poll loop.

pym/_emerge/QueueScheduler.py

index 99cfb23a8075a2096d6ded6f0947e7da1e89b124..e34758a85a4ff1cc943c583671e11fbdc2d1f788 100644 (file)
@@ -38,7 +38,7 @@ class QueueScheduler(PollScheduler):
                if timeout is not None:
                        def timeout_callback():
                                timeout_callback.timed_out = True
-                               return False
+                               raise StopIteration()
                        timeout_callback.timed_out = False
                        timeout_callback.timeout_id = self.sched_iface.timeout_add(
                                timeout, timeout_callback)
@@ -53,6 +53,8 @@ class QueueScheduler(PollScheduler):
                                timeout_callback.timed_out) and self._running_job_count():
                                self.sched_iface.iteration()
 
+               except StopIteration:
+                       pass
                finally:
                        if timeout_callback is not None:
                                self.sched_iface.unregister(timeout_callback.timeout_id)