summaryrefslogtreecommitdiff
path: root/mail/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-17 10:52:48 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 11:39:51 -0400
commit1e01e1caff8f04ce7a6488c25cc5cfd7592a4316 (patch)
tree77d684c33da51507f1976e866a3ffa305d469486 /mail/src/leap
parent16084ee4a0cd7e1246e638c109dcc0ccba87dba1 (diff)
freeze dirty/new sets to avoid changes during iteration
Diffstat (limited to 'mail/src/leap')
-rw-r--r--mail/src/leap/mail/imap/memorystore.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mail/src/leap/mail/imap/memorystore.py b/mail/src/leap/mail/imap/memorystore.py
index 2d1f95b2..f23a2344 100644
--- a/mail/src/leap/mail/imap/memorystore.py
+++ b/mail/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)