From ea8cb012d563bdce3eeeec6f85874503b0048928 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 11 Feb 2012 15:56:07 -0800 Subject: [PATCH] EventLoop.iteration: handle _poll StopIteration --- pym/portage/util/_eventloop/EventLoop.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py index c059197c1..0da388d03 100644 --- a/pym/portage/util/_eventloop/EventLoop.py +++ b/pym/portage/util/_eventloop/EventLoop.py @@ -177,7 +177,13 @@ class EventLoop(object): timeout = self._timeout_interval else: timeout = 0 - self._poll(timeout=timeout) + try: + self._poll(timeout=timeout) + except StopIteration: + # This could happen if there are no IO event handlers + # after _poll() calls _run_timeouts(), due to them + # being removed by timeout or idle callbacks. + events_handled += 1 try: while event_handlers and self._poll_event_queue: -- 2.26.2