New submission from Anton Khirnov <an...@khirnov.net>:
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.<baz@spam> ---------- 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 <rep...@bugs.python.org> <https://bugs.python.org/issue43501> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com