[Python-checkins] cpython (merge default -> default): Merge heads
serhiy.storchaka
python-checkins at python.org
Tue Jul 22 10:06:02 CEST 2014
http://hg.python.org/cpython/rev/6a65b7bcc137
changeset: 91762:6a65b7bcc137
parent: 91758:c755a3b58fa6
parent: 91756:2c660948bb41
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue Jul 22 11:03:16 2014 +0300
summary:
Merge heads
files:
Lib/test/test_urllib2.py | 3 ++-
Lib/urllib/request.py | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -678,7 +678,7 @@
self.assertEqual(int(headers["Content-length"]), len(data))
def test_file(self):
- import email.utils, socket
+ import email.utils
h = urllib.request.FileHandler()
o = h.parent = MockOpener()
@@ -725,6 +725,7 @@
for url in [
"file://localhost:80%s" % urlpath,
"file:///file_does_not_exist.txt",
+ "file://not-a-local-host.com//dir/file.txt",
"file://%s:80%s/%s" % (socket.gethostbyname('localhost'),
os.getcwd(), TESTFN),
"file://somerandomhost.ontheinternet.com%s/%s" %
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1315,7 +1315,7 @@
url = req.selector
if url[:2] == '//' and url[2:3] != '/' and (req.host and
req.host != 'localhost'):
- if not req.host is self.get_names():
+ if not req.host in self.get_names():
raise URLError("file:// scheme is supported only on localhost")
else:
return self.open_local_file(req)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list