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
de91276a
Commit
de91276a
authored
Mar 16, 2011
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#11401: handle headers with no value.
parent
6d94bd47
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
Lib/email/header.py
Lib/email/header.py
+1
-1
Lib/email/test/test_email.py
Lib/email/test/test_email.py
+7
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/email/header.py
View file @
de91276a
...
@@ -304,7 +304,7 @@ class Header:
...
@@ -304,7 +304,7 @@ class Header:
self
.
_continuation_ws
,
splitchars
)
self
.
_continuation_ws
,
splitchars
)
for
string
,
charset
in
self
.
_chunks
:
for
string
,
charset
in
self
.
_chunks
:
lines
=
string
.
splitlines
()
lines
=
string
.
splitlines
()
formatter
.
feed
(
lines
[
0
],
charset
)
formatter
.
feed
(
lines
[
0
]
if
lines
else
''
,
charset
)
for
line
in
lines
[
1
:]:
for
line
in
lines
[
1
:]:
formatter
.
newline
()
formatter
.
newline
()
if
charset
.
header_encoding
is
not
None
:
if
charset
.
header_encoding
is
not
None
:
...
...
Lib/email/test/test_email.py
View file @
de91276a
...
@@ -3296,6 +3296,13 @@ A very long line that must get split to something other than at the
...
@@ -3296,6 +3296,13 @@ A very long line that must get split to something other than at the
h
=
Header
(
'文'
,
charset
=
'shift_jis'
)
h
=
Header
(
'文'
,
charset
=
'shift_jis'
)
self
.
assertEqual
(
h
.
encode
(),
'=?iso-2022-jp?b?GyRCSjgbKEI=?='
)
self
.
assertEqual
(
h
.
encode
(),
'=?iso-2022-jp?b?GyRCSjgbKEI=?='
)
def
test_flatten_header_with_no_value
(
self
):
# Issue 11401 (regression from email 4.x) Note that the space after
# the header doesn't reflect the input, but this is also the way
# email 4.x behaved. At some point it would be nice to fix that.
msg
=
email
.
message_from_string
(
"EmptyHeader:"
)
self
.
assertEqual
(
str
(
msg
),
"EmptyHeader:
\
n
\
n
"
)
# Test RFC 2231 header parameters (en/de)coding
# Test RFC 2231 header parameters (en/de)coding
...
...
Misc/NEWS
View file @
de91276a
...
@@ -40,6 +40,9 @@ Core and Builtins
...
@@ -40,6 +40,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #11401: fix handling of headers with no value; this fixes a regression
relative to Python2 and the result is now the same as it was in Python2.
- Issue #9298: base64 bodies weren't being folded to line lengths less than 78,
- Issue #9298: base64 bodies weren't being folded to line lengths less than 78,
which was a regression relative to Python2. Unlike Python2, the last line
which was a regression relative to Python2. Unlike Python2, the last line
of the folded body now ends with a carriage return.
of the folded body now ends with a carriage return.
...
...
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