diff options
author | Kali Kaneko <kali@leap.se> | 2014-02-17 10:52:48 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-02-17 11:39:51 -0400 |
commit | e9488bf377f07f6f05d3fdd2eb316843cf561605 (patch) | |
tree | c943f81dadfaf87eeb63238602796063d819e70e /src | |
parent | 5af059a237833f52869a632e490ff932315a4939 (diff) |
freeze dirty/new sets to avoid changes during iteration
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/mail/imap/memorystore.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/leap/mail/imap/memorystore.py b/src/leap/mail/imap/memorystore.py index 2d1f95b..f23a234 100644 --- a/src/leap/mail/imap/memorystore.py +++ b/src/leap/mail/imap/memorystore.py @@ -889,7 +889,8 @@ class MemoryStore(object): :rtype: generator """ gm = self.get_message - new = [gm(*key, dirtystate=DirtyState.new) for key in self._new] + # need to freeze, set can change during iteration + new = [gm(*key, dirtystate=DirtyState.new) for key in tuple(self._new)] # move content from new set to the queue self._new_queue.update(self._new) self._new.difference_update(self._new) @@ -903,8 +904,9 @@ class MemoryStore(object): :rtype: generator """ gm = self.get_message + # need to freeze, set can change during iteration dirty = [gm(*key, flags_only=True, dirtystate=DirtyState.dirty) - for key in self._dirty] + for key in tuple(self._dirty)] # move content from new and dirty sets to the queue self._dirty_queue.update(self._dirty) |