From 1f1e49dfcbb1858af8a0a09165bb311aac33b423 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 25 Mar 2011 09:52:40 -0700 Subject: [PATCH] PollScheduler: tweak _unregister event cleanup --- pym/_emerge/PollScheduler.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py index 043f02a8b..a2b5c2466 100644 --- a/pym/_emerge/PollScheduler.py +++ b/pym/_emerge/PollScheduler.py @@ -250,13 +250,17 @@ class PollScheduler(object): # delivered to a future handler that is using a reallocated # file descriptor of the same numeric value (causing # extremely confusing bugs). - remove = set() + remaining_events = [] + discarded_events = False for event in self._poll_event_queue: if event[0] == f: - remove.add(event) - if remove: - self._poll_event_queue[:] = [event for event in \ - self._poll_event_queue if event not in remove] + discarded_events = True + else: + remaining_events.append(event) + + if discarded_events: + self._poll_event_queue[:] = remaining_events + del self._poll_event_handlers[f] del self._poll_event_handler_ids[reg_id] -- 2.26.2