Author Windson Yang
Recipients Dain Dwarf, Windson Yang, barry, bortzmeyer, cnicodeme, jpic, kal.sze, msapiro, ned.deily, nicoe, r.david.murray, vstinner, xtreak
Date 2019-05-03.01:45:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556847921.22.0.80106713067.issue34155@roundup.psfhosted.org>
In-reply-to
Content
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 'foo@bar.com@example.com' will return ('', 'foo@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.
History
Date User Action Args
2019-05-03 01:45:21Windson Yangsetrecipients: + Windson Yang, barry, vstinner, msapiro, ned.deily, r.david.murray, nicoe, kal.sze, xtreak, cnicodeme, bortzmeyer, jpic, Dain Dwarf
2019-05-03 01:45:21Windson Yangsetmessageid: <1556847921.22.0.80106713067.issue34155@roundup.psfhosted.org>
2019-05-03 01:45:21Windson Yanglinkissue34155 messages
2019-05-03 01:45:21Windson Yangcreate