From: Benjamin Peterson Date: Thu, 20 Feb 2014 03:56:35 +0000 (-0500) Subject: open retrieved file in binary mode, since it's now compressed X-Git-Tag: 3.1~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e834ed943771b2c55847cf336c41dbc0eb66ef25;p=thirdparty%2FPython%2Fcpython.git open retrieved file in binary mode, since it's now compressed --- diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index 0ab3f514f1bc..8b945feb197c 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -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: