summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-09-05 01:14:07 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-09-05 01:14:07 (GMT)
commit342456d5d25be692c3ddd43d0446b52555251ccc (patch)
treec1e84408193790c379f11b9ceef44741de98905e
parentd918884bb884c0568b6ac64dba9771c1368f0b5d (diff)
downloadcpython-342456d5d25be692c3ddd43d0446b52555251ccc.zip
cpython-342456d5d25be692c3ddd43d0446b52555251ccc.tar.gz
cpython-342456d5d25be692c3ddd43d0446b52555251ccc.tar.bz2
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.
-rwxr-xr-xLib/smtplib.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index a6f113c..066fd9c 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