Windson Yang <wiwind...@outlook.com> added the comment:

I found the issue located in 
https://github.com/python/cpython/blob/master/Lib/email/_parseaddr.py#L277

elif self.field[self.pos] in '.@':
    # email address is just an addrspec
    # this isn't very efficient since we start over
    self.pos = oldpos
    self.commentlist = oldcl
    addrspec = self.getaddrspec()
    returnlist = [(SPACE.join(self.commentlist), addrspec)]

The parseaddr function runs a for in loop over the input string, when it meets 
'.@' it will do something. That is why when the input string is 
'f...@bar.com@example.com' will return ('', 'f...@bar.com'). One possible 
solution will be to check the string in the reverse order then we can always 
get the last '@' in the string.

----------
nosy: +Windson Yang

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

Reply via email to