From aa55b38e26e0ccb904638b4b99f563a45ab3ec0e Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Thu, 10 Jul 2014 10:24:11 +0400 Subject: [PATCH] Avoid copying array every time, just slice it Suggested-by: Josh Berry Signed-off-by: Eygene Ryabinkin --- Changelog.rst | 2 ++ offlineimap/folder/IMAP.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Changelog.rst b/Changelog.rst index 781e252..0b485ee 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -17,6 +17,8 @@ OfflineIMAP v6.5.6.1 (YYYY-MM-DD) * Various fixes in documentation. +* Fix unbounded recursion during flag update (Josh Berry). + OfflineIMAP v6.5.6 (2014-05-14) =============================== diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 05e0a36..e317baf 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -801,9 +801,9 @@ class IMAPFolder(BaseFolder): def __processmessagesflags(self, operation, uidlist, flags): # Hack for those IMAP servers with a limited line length batch_size = 100 - while len(uidlist): - self.__processmessagesflags_real(operation, uidlist[:batch_size], flags) - uidlist = uidlist[batch_size:] + for i in xrange(0, len(uidlist), batch_size): + self.__processmessagesflags_real(operation, + uidlist[i:i + batch_size], flags) return