From f830a529961b54d136aac71e1e499e6735627d99 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 20 Dec 2001 15:54:48 +0000 Subject: 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 "", 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 "".] --- Lib/rfc822.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/rfc822.py b/Lib/rfc822.py index 9ad2f8f..96ab21c 100644 --- a/Lib/rfc822.py +++ b/Lib/rfc822.py @@ -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() -- cgit v0.12