summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-08-15 11:50:52 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-08-15 11:50:52 (GMT)
commitf748a3773fd40dd91195fc2fef2cac2f973baaf8 (patch)
tree2f26efbb8f49897dad34d1a5f2a7020ff7419197
parent8f773493b6c27a9b6bc3a1aceac107a0f3d669c8 (diff)
parent3d12c4317c2970d65bf30e941070017a8d1be210 (diff)
downloadcpython-f748a3773fd40dd91195fc2fef2cac2f973baaf8.zip
cpython-f748a3773fd40dd91195fc2fef2cac2f973baaf8.tar.gz
cpython-f748a3773fd40dd91195fc2fef2cac2f973baaf8.tar.bz2
merge heads in 3.2 branch
-rw-r--r--Lib/mailbox.py2
-rw-r--r--Lib/test/test_mailbox.py18
-rw-r--r--Misc/NEWS2
3 files changed, 9 insertions, 13 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 8b00460..73fe7d6 100644
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -1443,9 +1443,9 @@ class Babyl(_singlefileMailbox):
line = line[:-1] + b'\n'
self._file.write(line.replace(b'\n', linesep))
if line == b'\n' or not line:
- self._file.write(b'*** EOOH ***' + linesep)
if first_pass:
first_pass = False
+ self._file.write(b'*** EOOH ***' + linesep)
message.seek(original_pos)
else:
break
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index 9f1fdad..65120f7 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -148,20 +148,16 @@ class TestMailbox(TestBase):
f.write(_bytes_sample_message)
f.seek(0)
key = self._box.add(f)
- # See issue 11062
- if not isinstance(self._box, mailbox.Babyl):
- self.assertEqual(self._box.get_bytes(key).split(b'\n'),
- _bytes_sample_message.split(b'\n'))
+ self.assertEqual(self._box.get_bytes(key).split(b'\n'),
+ _bytes_sample_message.split(b'\n'))
def test_add_binary_nonascii_file(self):
with tempfile.TemporaryFile('wb+') as f:
f.write(self._non_latin_bin_msg)
f.seek(0)
key = self._box.add(f)
- # See issue 11062
- if not isinstance(self._box, mailbox.Babyl):
- self.assertEqual(self._box.get_bytes(key).split(b'\n'),
- self._non_latin_bin_msg.split(b'\n'))
+ self.assertEqual(self._box.get_bytes(key).split(b'\n'),
+ self._non_latin_bin_msg.split(b'\n'))
def test_add_text_file_warns(self):
with tempfile.TemporaryFile('w+') as f:
@@ -169,10 +165,8 @@ class TestMailbox(TestBase):
f.seek(0)
with self.assertWarns(DeprecationWarning):
key = self._box.add(f)
- # See issue 11062
- if not isinstance(self._box, mailbox.Babyl):
- self.assertEqual(self._box.get_bytes(key).split(b'\n'),
- _bytes_sample_message.split(b'\n'))
+ self.assertEqual(self._box.get_bytes(key).split(b'\n'),
+ _bytes_sample_message.split(b'\n'))
def test_add_StringIO_warns(self):
with self.assertWarns(DeprecationWarning):
diff --git a/Misc/NEWS b/Misc/NEWS
index 5d69e95..1e1e0c5 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -101,6 +101,8 @@ Core and Builtins
Library
-------
+- Issue #11062: Fix adding a message from file to Babyl mailbox.
+
- Issue #15646: Prevent equivalent of a fork bomb when using
multiprocessing on Windows without the "if __name__ == '__main__'"
idiom.