Patches item #1762940, was opened at 2007-07-28 21:12 Message generated for change (Comment added) made by gvanrossum You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1762940&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Tests Group: Python 3000 >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Joe Gregorio (jcgregorio) >Assigned to: Guido van Rossum (gvanrossum) Summary: struni: test_urllib2, test_cookielib Initial Comment: This patch fixes the unit tests of both test_urllib2 and test_cookielib. The reason for combining them is that they both needed the changes to urllib.quote(). The largest part of this patch is to urllib.quote(), which would operate on unicode strings, but only so long as they didn't stray out of the ASCII range. The old code would create a dictionary with 256 entries that mapped incoming chars to their 'safe' replacements, and that dict was created once in its entirety when the function was first called and cached for later calls. Since the incoming character string is now unicode that method won't work. The new code does not build the dict in its entirety, instead it memoizes the ASCII range translations as it runs. It does not memoize translations outside of the ASCII range as that would be hole by which you could exhaust a programs memory. ---------------------------------------------------------------------- >Comment By: Guido van Rossum (gvanrossum) Date: 2007-08-03 15:19 Message: Logged In: YES user_id=6380 Originator: NO Committed revision 56709. ---------------------------------------------------------------------- Comment By: Joe Gregorio (jcgregorio) Date: 2007-07-29 14:25 Message: Logged In: YES user_id=81604 Originator: YES This is an updated patch that simplifies the translation of characters. Instead of having a closure for the quoting and then wrapping it in a Memoize instance, this patch just creates a simple Quoter class that does the translation and caching. File Added: urllib2-cookie-quote-2.patch ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1762940&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches