mirror of
https://github.com/python/cpython.git
synced 2025-11-20 02:50:14 +00:00
SF patch #495358 (Artur Zaprzala): rfc822.AddressList and "<>" address
rfc822.AddressList incorrectly handles empty address.
"<>" is converted to None and should be "".
AddressList.__str__() fails on None.
I got an email with such an address and my program
failed processing it.
Example:
>>> import rfc822
>>> rfc822.AddressList("<>").addresslist
[('', None)]
>>> str(rfc822.AddressList("<>"))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.1/rfc822.py", line 753, in __str__
return ", ".join(map(dump_address_pair,
self.addresslist))
TypeError: sequence item 0: expected string, None found
[His solution: in the internal routine AddrlistClass.getrouteaddr(),
initialize adlist to "".]
This commit is contained in:
parent
54dc1d31ab
commit
f830a52996
1 changed files with 1 additions and 1 deletions
|
|
@ -624,7 +624,7 @@ class AddrlistClass:
|
|||
expectroute = 0
|
||||
self.pos = self.pos + 1
|
||||
self.gotonext()
|
||||
adlist = None
|
||||
adlist = ""
|
||||
while self.pos < len(self.field):
|
||||
if expectroute:
|
||||
self.getdomain()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue