[Python-checkins] r59481 - in python/branches/release25-maint/Lib: test/test_urlparse.py urlparse.py
alexandre.vassalotti
python-checkins at python.org
Thu Dec 13 19:18:48 CET 2007
Author: alexandre.vassalotti
Date: Thu Dec 13 19:18:47 2007
New Revision: 59481
Modified:
python/branches/release25-maint/Lib/test/test_urlparse.py
python/branches/release25-maint/Lib/urlparse.py
Log:
Backport r59480.
Fix issue #1313119.
Modified: python/branches/release25-maint/Lib/test/test_urlparse.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_urlparse.py (original)
+++ python/branches/release25-maint/Lib/test/test_urlparse.py Thu Dec 13 19:18:47 2007
@@ -287,6 +287,16 @@
self.assertEqual(p.port, None)
self.assertEqual(p.geturl(), uri)
+ def test_caching(self):
+ # Test case for bug #1313119
+ uri = "http://example.com/doc/"
+ unicode_uri = unicode(uri)
+
+ urlparse.urlparse(unicode_uri)
+ p = urlparse.urlparse(uri)
+ self.assertEqual(type(p.scheme), type(uri))
+ self.assertEqual(type(p.hostname), type(uri))
+ self.assertEqual(type(p.path), type(uri))
def test_main():
test_support.run_unittest(UrlParseTestCase)
Modified: python/branches/release25-maint/Lib/urlparse.py
==============================================================================
--- python/branches/release25-maint/Lib/urlparse.py (original)
+++ python/branches/release25-maint/Lib/urlparse.py Thu Dec 13 19:18:47 2007
@@ -184,7 +184,7 @@
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes."""
allow_fragments = bool(allow_fragments)
- key = url, scheme, allow_fragments
+ key = url, scheme, allow_fragments, type(url), type(scheme)
cached = _parse_cache.get(key, None)
if cached:
return cached
More information about the Python-checkins
mailing list