bpoaugust <sebbaz+...@gmail.com> added the comment:

Sorry, I think '<A@A.A.A A.A>' is not valid, as spaces are not allowed between 
words.

However I am not seeing the original unfolded source if there is an error, 
unless I am misunderstanding the API.

For example:

--- cut here ---
import email.header
import email.utils
import email.policy

def test(test):
    msg_string = f"Message-id: {test}"
    message = email.message_from_string(msg_string, policy=email.policy.default)
    out = message['Message-id']
    print(test)
    print(out)

test('<A@A.A.A A.A>') # invalid
test('<a...@a.a.aa.A>') # valid
--- cut here ---

This produces:

<A@A.A.A A.A>
<A@A.A.A> # truncated at error
<a...@a.a.aa.A>
<a...@a.a.aa.A>

i.e. the invalid input is truncated

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46392>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to