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
8fe9eed9
Commit
8fe9eed9
authored
Jul 28, 2018
by
Dong-hee Na
Committed by
Steve Dower
Jul 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-33476: Fix _header_value_parser when address group is missing final ';' (GH-7484)
parent
1d2dafa2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
Lib/email/_header_value_parser.py
Lib/email/_header_value_parser.py
+1
-1
Lib/test/test_email/test__header_value_parser.py
Lib/test/test_email/test__header_value_parser.py
+25
-0
Misc/NEWS.d/next/Library/2018-06-08-00-29-40.bpo-33476.R0Bhlj.rst
...S.d/next/Library/2018-06-08-00-29-40.bpo-33476.R0Bhlj.rst
+2
-0
No files found.
Lib/email/_header_value_parser.py
View file @
8fe9eed9
...
...
@@ -1875,7 +1875,7 @@ def get_group(value):
if
not
value
:
group
.
defects
.
append
(
errors
.
InvalidHeaderDefect
(
"end of header in group"
))
if
value
[
0
]
!=
';'
:
el
if
value
[
0
]
!=
';'
:
raise
errors
.
HeaderParseError
(
"expected ';' at end of group but found {}"
.
format
(
value
))
group
.
append
(
ValueTerminal
(
';'
,
'group-terminator'
))
...
...
Lib/test/test_email/test__header_value_parser.py
View file @
8fe9eed9
...
...
@@ -2152,6 +2152,31 @@ class TestParser(TestParserMixin, TestEmailBase):
self.assertEqual(group.mailboxes[1].local_part, '
x
')
self.assertIsNone(group.all_mailboxes[1].display_name)
def test_get_group_missing_final_semicol(self):
group = self._test_get_x(parser.get_group,
('
Monty
Python
:
"Fred A. Bear"
<
dinsdale
@
example
.
com
>
,
'
'
eric
@
where
.
test
,
John
<
jdoe
@
test
>
'),
('
Monty
Python
:
"Fred A. Bear"
<
dinsdale
@
example
.
com
>
,
'
'
eric
@
where
.
test
,
John
<
jdoe
@
test
>
;
'),
('
Monty
Python
:
"Fred A. Bear"
<
dinsdale
@
example
.
com
>
,
'
'
eric
@
where
.
test
,
John
<
jdoe
@
test
>
;
'),
[errors.InvalidHeaderDefect],
'')
self.assertEqual(group.token_type, '
group
')
self.assertEqual(group.display_name, '
Monty
Python
')
self.assertEqual(len(group.mailboxes), 3)
self.assertEqual(group.mailboxes,
group.all_mailboxes)
self.assertEqual(group.mailboxes[0].addr_spec,
'
dinsdale
@
example
.
com
')
self.assertEqual(group.mailboxes[0].display_name,
'
Fred
A
.
Bear
')
self.assertEqual(group.mailboxes[1].addr_spec,
'
eric
@
where
.
test
')
self.assertEqual(group.mailboxes[2].display_name,
'
John
')
self.assertEqual(group.mailboxes[2].addr_spec,
'
jdoe
@
test
')
# get_address
def test_get_address_simple(self):
...
...
Misc/NEWS.d/next/Library/2018-06-08-00-29-40.bpo-33476.R0Bhlj.rst
0 → 100644
View file @
8fe9eed9
Fix _header_value_parser.py when address group is missing final ';'.
Contributed by Enrique Perez-Terron
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