]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
getaddrlist(): Make sure this consumes all the data, and if there is
authorBarry Warsaw <barry@python.org>
Mon, 17 Mar 2003 18:35:42 +0000 (18:35 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 17 Mar 2003 18:35:42 +0000 (18:35 +0000)
no address there (perhaps because of invalid characters, it appends
('', '') to the result set.

Closes mimelib SF bug # 697641.

Lib/email/_parseaddr.py

index ef9423aadf7ac117533bad2960484b9e2df95c9e..2b28b64304887b7ffcf63477ba22f28f4cead807 100644 (file)
@@ -196,12 +196,12 @@ class AddrlistClass:
         Returns a list containing all of the addresses.
         """
         result = []
-        while True:
+        while self.pos < len(self.field):
             ad = self.getaddress()
             if ad:
                 result += ad
             else:
-                break
+                result.append(('', ''))
         return result
 
     def getaddress(self):