-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The following code breaks with an attribute error:
import email.parser
import email.policy
a = 't'*46
h = f'''\
To: =?utf-8?B?dGVzdC50ZXN0LnRlc3QudGVzdEB0ZXN0LmNvbeKAiw=?= <test@test.com>,\r\n\t"tttest&{a}.t.t.t.t.t.t.t@yahoo.ES" <test@test.tj>,\r\n\t"tttest&{a}.t.t.t.t.t.t@yahoo.ES" <info@test.tj>'''
m = email.parser.HeaderParser(policy=email.policy.default).parsestr(h)
m.as_string()
The problem was introduced on #100885, setting ListSeparator.as_ew_allowed = False
to True
fixes the problem. Changing any character in the header in the example above also fixes the problem (which makes it harder to understand exactly why it's broken).
CPython versions tested on:
3.12
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error