mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
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.
This commit is contained in:
parent
d918884bb8
commit
342456d5d2
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue