[Python-bugs-list] [ python-Bugs-495358 ] rfc822.AddressList and "<>" address

noreply@sourceforge.net noreply@sourceforge.net
Sat, 22 Dec 2001 23:02:23 -0800


Bugs item #495358, was opened at 2001-12-20 03:00
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=495358&group_id=5470

Category: Python Library
Group: Python 2.1.1
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Artur Zaprzala (zybi)
Assigned to: Anthony Baxter (anthonybaxter)
>Summary: rfc822.AddressList and "<>" address

Initial Comment:
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

Patch is attached.


----------------------------------------------------------------------

>Comment By: Anthony Baxter (anthonybaxter)
Date: 2001-12-22 23:02

Message:
Logged In: YES 
user_id=29957

this is checked in. 


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-20 07:55

Message:
Logged In: YES 
user_id=6380

Thanks! Applied to Python 2.2 in CVS.

Assigned to Anthony as a 2.1.2 candidate.

----------------------------------------------------------------------

Comment By: Barry Warsaw (bwarsaw)
Date: 2001-12-20 07:27

Message:
Logged In: YES 
user_id=12800

Looks okay to me.  Accepted the patch, but I'll leave it to
Guido to commit.  +1 for Py2.2.  test_email.py and
test_rfc822.py both continue to pass (which tells me they
really don't test this case ;).

Or assign the patch to me and I'll commit it, update the
test suite and docs.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-20 05:03

Message:
Logged In: YES 
user_id=6380

I want this reviewed before Python 2.2 goes out tomorrow.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=495358&group_id=5470