From: Raymond Hettinger Date: Thu, 5 Sep 2002 01:14:07 +0000 (+0000) Subject: smptlib did not handle empty addresses. X-Git-Tag: v2.3c1~4212 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=342456d5d25be692c3ddd43d0446b52555251ccc;p=python smptlib did not handle empty addresses. The problem was that it expected rfc822.parseaddr() to return None upon a parse failure. The actual, documented return value for a parse failure is (None, None). Closes SF bug 602029. --- diff --git a/Lib/smtplib.py b/Lib/smtplib.py index a6f113cd7c..066fd9c8e2 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -168,14 +168,14 @@ def quoteaddr(addr): Should be able to handle anything rfc822.parseaddr can handle. """ - m=None + m = (None, None) try: m=rfc822.parseaddr(addr)[1] except AttributeError: pass - if not m: + if m == (None, None): # Indicates parse failure or AttributeError #something weird here.. punt -ddm - return addr + return "<%s>" % addr else: return "<%s>" % m