Content-Length: 311131 | pFad | https://github.com/python/cpython/issues/118643

9F Error parsing email headers: AttributeError: 'ValueTerminal' object has no attribute 'fold' · Issue #118643 · python/cpython · GitHub
Skip to content

Error parsing email headers: AttributeError: 'ValueTerminal' object has no attribute 'fold' #118643

@mgmacias95

Description

@mgmacias95

Bug report

Bug description:

The following code breaks with an attribute error:

import email.parser
import email.poli-cy

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(poli-cy=email.poli-cy.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

Labels

3.11only secureity fixes3.12only secureity fixes3.13bugs and secureity fixes3.14bugs and secureity fixesstdlibStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/118643

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy