diff options
author | Petri Lehtinen <petri@digip.org> | 2012-06-15 17:50:51 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2012-06-15 17:50:51 (GMT) |
commit | 7cf66996992eeb7f3ad4c19f960b967e1beb5fa3 (patch) | |
tree | 44bde88b6377bdb57949ad7f0685ea16b667ecb6 | |
parent | 5ec84cd69e69739bd4ca799f611f5ec75bac6a31 (diff) | |
download | cpython-7cf66996992eeb7f3ad4c19f960b967e1beb5fa3.zip cpython-7cf66996992eeb7f3ad4c19f960b967e1beb5fa3.tar.gz cpython-7cf66996992eeb7f3ad4c19f960b967e1beb5fa3.tar.bz2 |
#15036: Make a repeated changes and flushes work with single-file mailboxes
-rw-r--r-- | Lib/mailbox.py | 1 | ||||
-rw-r--r-- | Lib/test/test_mailbox.py | 11 | ||||
-rw-r--r-- | Misc/NEWS | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 0efd743..6a69819 100644 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -649,6 +649,7 @@ class _singlefileMailbox(Mailbox): 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 index 480d586..6ebd1a2 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -386,6 +386,17 @@ class TestMailbox(TestBase): # 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())) @@ -67,6 +67,10 @@ Core and Builtins Library ------- +- Issue #15036: Allow removing or changing multiple items in + single-file mailboxes (mbox, MMDF, Babyl) flushing the mailbox + between the changes. + - Issue #10133: Make multiprocessing deallocate buffer if socket read fails. Patch by Hallvard B Furuseth. |