[issue39100] email.policy.SMTP throws AttributeError on invalid header
Anton Khirnov added the comment: Ping yet again. Can anyone please look at this? -- ___ Python tracker <https://bugs.python.org/issue39100> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39100] email.policy.SMTP throws AttributeError on invalid header
Change by Anton Khirnov : -- keywords: +patch pull_requests: +23633 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24872 ___ Python tracker <https://bugs.python.org/issue39100> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43501] email._header_value_parse throws AttributeError on display name ending with dot
New submission from Anton Khirnov : On parsing an email where the display name in an address ends on a dot immediately followed by angle-addr, accessing the resulting mailbox display_name throws /usr/lib/python3.9/email/_header_value_parser.py in value(self) 589 if self[0].token_type=='cfws' or self[0][0].token_type=='cfws': 590 pre = ' ' --> 591 if self[-1].token_type=='cfws' or self[-1][-1].token_type=='cfws': 592 post = ' ' 593 return pre+quote_string(self.display_name)+post AttributeError: 'str' object has no attribute 'token_type' The problem is that self[-1] is the terminal DOT. An example of the problematic header is: From: foobar. -- components: email messages: 388738 nosy: barry, elenril, r.david.murray priority: normal severity: normal status: open title: email._header_value_parse throws AttributeError on display name ending with dot type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue43501> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43501] email._header_value_parse throws AttributeError on display name ending with dot
Change by Anton Khirnov : -- keywords: +patch pull_requests: +23636 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24874 ___ Python tracker <https://bugs.python.org/issue43501> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39100] email.policy.SMTP throws AttributeError on invalid header
Anton Khirnov added the comment: Quoting R. David Murray (2021-07-06 18:59:56) > How are you encountering this error? The following program runs without > exception for me on master: > > from email import message_from_binary_file > from email.policy import SMTP > > msg = message_from_binary_file(open('mail.eml', 'rb'), policy=SMTP) > print(msg) The exception is thrown on accessing the 'to' header, so make that print(msg['to']) -- ___ Python tracker <https://bugs.python.org/issue39100> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39100] email.policy.SMTP throws AttributeError on invalid header
Anton Khirnov added the comment: Quoting Andrei Kulakov (2021-07-03 16:03:34) > Anton: thanks for the report! In the message you say you are not sure > of the solution, and because of that not sending a patch, but then you > created the PR; - please clarify. I didn't send a patch when originally submitting the bugreport in 2019. I did write a patch about a year later, since there was no response to the bugreport. -- ___ Python tracker <https://bugs.python.org/issue39100> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39100] email.policy.SMTP throws AttributeError on invalid header
New submission from Anton Khirnov : When parsing a (broken) mail from linux-me...@vger.kernel.org (message-id 20190212181908.horde.peighvv2khy9ekuy8ta8...@webmail.your-server.de, headers attached) with email.policy.SMTP, I get an AttributeError on trying to read the 'to' header: /usr/lib/python3.7/email/headerregistry.py in (.0) 345 mb.local_part or '', 346 mb.domain or '') --> 347 for mb in addr.all_mailboxes])) 348 defects = list(address_list.all_defects) 349 else: AttributeError: 'Group' object has no attribute 'local_part' The header in question is: To: unlisted-recipients:; (no To-header on input) The problem seems to be that mb is a Group and not an Address, gets token_type of 'invalid-mailbox', but does not have the attributes local_part/domain that are expected in mailboxes. Copying the line local_part = domain = route = addr_spec = display_name from InvalidMailbox to Group fixes this, but it is not clear to me this is the right solution, so not sending a patch. -- components: email files: mail.eml messages: 358689 nosy: barry, elenril, r.david.murray priority: normal severity: normal status: open title: email.policy.SMTP throws AttributeError on invalid header type: behavior Added file: https://bugs.python.org/file48792/mail.eml ___ Python tracker <https://bugs.python.org/issue39100> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30820] email.contentmanager.raw_data_manager fails to create multipart messages
New submission from Anton Khirnov: The documentation for the "new API" -- email.contentmanager.raw_data_manager -- claims that passing a list of messages to set_content() will create a multipart message. However, it fails with "KeyError: 'builtins.list'" and from looking at the code it seems this functionality is not and never was implemented. -- components: email messages: 297430 nosy: barry, elenril, r.david.murray priority: normal severity: normal status: open title: email.contentmanager.raw_data_manager fails to create multipart messages type: behavior versions: Python 3.5, Python 3.6 ___ Python tracker <http://bugs.python.org/issue30820> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com