summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-05 01:26:36 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-05 01:26:36 +0000
commit7cdad53557e97b101213e93a3cf9b723edb0740d (patch)
treeff963c793310bef5f53668731bfef488dff9cef7
parent81294043a4370f5f5a8b04d5256035a5e05ce050 (diff)
downloadportage-7cdad53557e97b101213e93a3cf9b723edb0740d.tar.gz
portage-7cdad53557e97b101213e93a3cf9b723edb0740d.tar.bz2
portage-7cdad53557e97b101213e93a3cf9b723edb0740d.zip
Bug #282808 - Handle a potential KeyError inside PollScheduler._poll_loop()
when _poll_event_queue contains an event for a file descriptor that has already been unregistered. svn path=/main/trunk/; revision=14185
-rw-r--r--pym/_emerge/PollScheduler.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py
index 3733af45b..8250cb00a 100644
--- a/pym/_emerge/PollScheduler.py
+++ b/pym/_emerge/PollScheduler.py
@@ -123,7 +123,14 @@ class PollScheduler(object):
try:
while event_handlers:
f, event = self._next_poll_event()
- handler, reg_id = event_handlers[f]
+ try:
+ handler, reg_id = event_handlers[f]
+ except KeyError:
+ # This means unregister was called for a file descriptor
+ # that still had a pending event in _poll_event_queue.
+ # Since unregister has been called, we should assume that
+ # the event can be safely ignored.
+ continue
handler(f, event)
event_handled = True
except StopIteration: