[Python-checkins] cpython (3.1): open retrieved file in binary mode, since it's now compressed

benjamin.peterson python-checkins at python.org
Thu Feb 20 05:07:26 CET 2014


http://hg.python.org/cpython/rev/fbb4d48046e5
changeset:   89294:fbb4d48046e5
branch:      3.1
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Feb 19 22:56:35 2014 -0500
summary:
  open retrieved file in binary mode, since it's now compressed

files:
  Lib/test/test_urllibnet.py |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -109,7 +109,7 @@
         # 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 @@
         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 @@
                                               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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list