]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
open retrieved file in binary mode, since it's now compressed
authorBenjamin Peterson <benjamin@python.org>
Thu, 20 Feb 2014 03:56:35 +0000 (22:56 -0500)
committerBenjamin Peterson <benjamin@python.org>
Thu, 20 Feb 2014 03:56:35 +0000 (22:56 -0500)
Lib/test/test_urllibnet.py

index 0ab3f514f1bc85c20df59ef419ca370f7919077d..8b945feb197c3b72110f83d586edd16858903cae 100644 (file)
@@ -109,7 +109,7 @@ class urlopenNetworkTests(unittest.TestCase):
         # Make sure fd returned by fileno is valid.
         open_url = self.urlopen("http://www.python.org/", timeout=None)
         fd = open_url.fileno()
-        FILE = os.fdopen(fd, encoding='utf-8')
+        FILE = os.fdopen(fd, 'rb')
         try:
             self.assertTrue(FILE.read(), "reading from file created using fd "
                                       "returned by fileno failed")
@@ -143,7 +143,7 @@ class urlretrieveNetworkTests(unittest.TestCase):
         file_location,info = self.urlretrieve("http://www.python.org/")
         self.assertTrue(os.path.exists(file_location), "file location returned by"
                         " urlretrieve is not a valid path")
-        FILE = open(file_location, encoding='utf-8')
+        FILE = open(file_location, 'rb')
         try:
             self.assertTrue(FILE.read(), "reading from the file location returned"
                          " by urlretrieve failed")
@@ -157,7 +157,7 @@ class urlretrieveNetworkTests(unittest.TestCase):
                                               support.TESTFN)
         self.assertEqual(file_location, support.TESTFN)
         self.assertTrue(os.path.exists(file_location))
-        FILE = open(file_location, encoding='utf-8')
+        FILE = open(file_location, 'rb')
         try:
             self.assertTrue(FILE.read(), "reading from temporary file failed")
         finally: