[issue1409460] email.Utils.parseaddr() gives arcane result

Éric Araujo report at bugs.python.org
Sat Jul 17 13:38:37 CEST 2010


Éric Araujo <merwok at netwok.org> added the comment:

I wonder if this bug should be reopened. This behavior does not seem right to me:

parsing 'merwok'
 expected ('merwok', '')
 got      ('', 'merwok')

parsing 'merwok wok at rusty'
 expected ('', 'wok at rusty')
 got      ('', 'merwokwok at rusty')

(Generated with a twenty-line script just doing a loop and prints, not attached because boring.)

Are my expectations wrong? I don’t know if a string like “merwok” in my first example is a legal address in the relevant RFCs, nor do I know if the folding done in the second example is okay.

For background, the thing I’m trying to achieve is to take a string and parse it into name and email address, and print a warning if there is no email. It’d be nice if I could always test for “not parseaddr(s)[1]”, or pass an argument to the function to get an exception. Maybe I’ll have to restrict my format and do my own parsing with str.[r]partition.

----------
nosy: +merwok, r.david.murray

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1409460>
_______________________________________


More information about the Python-bugs-list mailing list