Skip to content

Commit 1b0fbe2

Browse files
committed
Correct imperfect fix for variation of this bug.
As part of fixing bpo-27931 code was introduced to get_bar_quoted_string that added an empty Terminal if the quoted string was empty. This isn't the best answer in terms of the parse tree, we really want the token list to be empty in that case. But having it be empty would result in local_part raising the index error. Which is the same bug we find if we try to parse an address consisting of a single dquote. So by fixing local_part to not raise in that case, we can have the bare_quoted_string code correctly return an empty token list for the empty string cases (two dquotes or a single dquote as the entire addrespec, at the end of a line). After this commit there will be two test failures instead of just one, and we'll fix both with the fix to local_part.
1 parent 7ca1758 commit 1b0fbe2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Lib/email/_header_value_parser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,7 @@ def get_bare_quoted_string(value):
12491249
bare_quoted_string = BareQuotedString()
12501250
value = value[1:]
12511251
if value and value[0] == '"':
1252-
token, value = get_qcontent(value)
1253-
bare_quoted_string.append(token)
1252+
return bare_quoted_string, value[1:]
12541253
while value and value[0] != '"':
12551254
if value[0] in WSP:
12561255
token, value = get_fws(value)

0 commit comments

Comments
 (0)