mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.14] gh-134155: fix AttributeError in email._header_value_parser.get_address (GH-134194) (#135191)
gh-134155: fix AttributeError in email._header_value_parser.get_address (GH-134194)
Append the defect to defects instead of to the parse tree.
(cherry picked from commit d9cad074d5
)
Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
88b5784fc0
commit
3faf00e003
3 changed files with 48 additions and 2 deletions
|
@ -1575,7 +1575,7 @@ def get_dtext(value):
|
|||
def _check_for_early_dl_end(value, domain_literal):
|
||||
if value:
|
||||
return False
|
||||
domain_literal.append(errors.InvalidHeaderDefect(
|
||||
domain_literal.defects.append(errors.InvalidHeaderDefect(
|
||||
"end of input inside domain-literal"))
|
||||
domain_literal.append(ValueTerminal(']', 'domain-literal-end'))
|
||||
return True
|
||||
|
@ -1594,9 +1594,9 @@ def get_domain_literal(value):
|
|||
raise errors.HeaderParseError("expected '[' at start of domain-literal "
|
||||
"but found '{}'".format(value))
|
||||
value = value[1:]
|
||||
domain_literal.append(ValueTerminal('[', 'domain-literal-start'))
|
||||
if _check_for_early_dl_end(value, domain_literal):
|
||||
return domain_literal, value
|
||||
domain_literal.append(ValueTerminal('[', 'domain-literal-start'))
|
||||
if value[0] in WSP:
|
||||
token, value = get_fws(value)
|
||||
domain_literal.append(token)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue