[issue9286] email.utils.parseaddr returns garbage for invalid input

Éric Araujo report at bugs.python.org
Sat Jul 17 16:35:59 CEST 2010

New submission from Éric Araujo <merwok at netwok.org>:

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 small 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; Mark Sapiro replied in msg110556 that it could be consistent with most MUAs/MTAs.

I don’t know either if the folding done in the second example is okay; I’d like an exception here, or if parseaddr is designed to never fail, empty strings to indicate failure. I’m also okay with “garbage in, garbage out” as answer.

components: Library (Lib)
messages: 110561
nosy: merwok, r.david.murray
priority: normal
severity: normal
status: open
title: email.utils.parseaddr returns garbage for invalid input
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list