Commits

Floris Bruynooghe committed 6ecc68c

Do not modify the list while iterating

Comments (0)

Files changed (1)

 # HG changeset patch
 # Parent e2a73a7f7e459d258010b40d0ce3b55aca4aa179
 # User Floris Bruynooghe <flub@devork.be>
-# Date 1337898924 -3600
+# Date 1338144464 -3600
 
 Create xthread package
 
              self.timers_canceled = 0
              self.timers = [t for t in self.timers if not t[1].called]
 -            self.next_timers = [t for t in self.next_timers if not t[1].called]
-+            for item in self.next_timers:
++            for item in self.next_timers[:]:
 +                if item[1].called:
 +                    self.next_timers.remove(item)
              heapq.heapify(self.timers)