Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3d12c431
Commit
3d12c431
authored
Aug 15, 2012
by
Petri Lehtinen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#11062: Fix adding a message from file to Babyl mailbox
parent
2b209cd7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
13 deletions
+9
-13
Lib/mailbox.py
Lib/mailbox.py
+1
-1
Lib/test/test_mailbox.py
Lib/test/test_mailbox.py
+6
-12
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/mailbox.py
View file @
3d12c431
...
...
@@ -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
...
...
Lib/test/test_mailbox.py
View file @
3d12c431
...
...
@@ -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
):
...
...
Misc/NEWS
View file @
3d12c431
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment