From: Zac Medico Date: Sat, 11 Feb 2012 23:56:07 +0000 (-0800) Subject: EventLoop.iteration: handle _poll StopIteration X-Git-Tag: v2.2.0_alpha86~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ea8cb012d563bdce3eeeec6f85874503b0048928;p=portage.git EventLoop.iteration: handle _poll StopIteration --- 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: