[Python-bugs-list] [ python-Bugs-481221 ] rfc822.Addrlist class fails on long addr
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 13 Nov 2001 12:52:54 -0800
Bugs item #481221, was opened at 2001-11-13 00:54
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481221&group_id=5470
Category: Python Library
Group: None
>Status: Open
Resolution: None
Priority: 5
Submitted By: Ondrej Palkovsky (ondrap)
Assigned to: Barry Warsaw (bwarsaw)
Summary: rfc822.Addrlist class fails on long addr
Initial Comment:
The Addrlistclass.getaddrlist uses recursion algorithm,
unfortunately on some _very_ large address fields it
exceeds the maximum recursion.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-11-13 12:52
Message:
Logged In: YES
user_id=31435
Barry, this very shallow, although it would be nice to have
a test case. Currently:
. ad = self.getaddress()
. if ad:
. return ad + self.getaddrlist()
. else: return []
Rewrite (untested):
. result = []
. while 1:
. ad = self.getaddress()
. if ad:
. result.append(ad)
. else:
. break
. return result
The original is also quadratic-time(!) in the # of
addresses -- it's obviously braindead Scheme code <wink>.
----------------------------------------------------------------------
Comment By: Barry Warsaw (bwarsaw)
Date: 2001-11-13 12:19
Message:
Logged In: YES
user_id=12800
Please provide attach a test case. It's unlikely that
this'll get fixed before Python 2.2 since it fixing it
probably requires a rewrite.
I wonder if this could use generators now? Can you provide
a patch?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=481221&group_id=5470