[Python-checkins] cpython (merge 3.2 -> default): #15036: Make a repeated changes and flushes work with single-file mailboxes
petri.lehtinen
python-checkins at python.org
Fri Jun 15 20:04:02 CEST 2012
http://hg.python.org/cpython/rev/87d119117560
changeset: 77445:87d119117560
parent: 77442:2d2f206d040e
parent: 77444:714b8f91f3d4
user: Petri Lehtinen <petri at digip.org>
date: Fri Jun 15 21:01:39 2012 +0300
summary:
#15036: Make a repeated changes and flushes work with single-file mailboxes
files:
Lib/mailbox.py | 1 +
Lib/test/test_mailbox.py | 11 +++++++++++
Misc/NEWS | 4 ++++
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -675,6 +675,7 @@
new_file.write(buffer)
new_toc[key] = (new_start, new_file.tell())
self._post_message_hook(new_file)
+ self._file_length = new_file.tell()
except:
new_file.close()
os.remove(new_file.name)
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -504,6 +504,17 @@
# Write changes to disk
self._test_flush_or_close(self._box.flush, True)
+ def test_popitem_and_flush_twice(self):
+ # See #15036.
+ self._box.add(self._template % 0)
+ self._box.add(self._template % 1)
+ self._box.flush()
+
+ self._box.popitem()
+ self._box.flush()
+ self._box.popitem()
+ self._box.flush()
+
def test_lock_unlock(self):
# Lock and unlock the mailbox
self.assertFalse(os.path.exists(self._get_lock_path()))
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,10 @@
Library
-------
+- Issue #15036: Allow removing or changing multiple items in
+ single-file mailboxes (mbox, MMDF, Babyl) flushing the mailbox
+ between the changes.
+
- Issue #14059: Implement multiprocessing.Barrier.
- Issue #15061: The inappropriately named hmac.secure_compare has been
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list