]> granicus.if.org Git - python/commit
SF patch #495358 (Artur Zaprzala): rfc822.AddressList and "<>" address
authorGuido van Rossum <guido@python.org>
Thu, 20 Dec 2001 15:54:48 +0000 (15:54 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 20 Dec 2001 15:54:48 +0000 (15:54 +0000)
commitf830a529961b54d136aac71e1e499e6735627d99
tree03e45272bb988d20cc0161c8c9eb0b7d4b1f1892
parent54dc1d31ab097dcffab8b21a6c13eb0286fd52ce
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 "".]
Lib/rfc822.py