8000 open retrieved file in binary mode, since it's now compressed · python/cpython@f6218a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit f6218a2

Browse files
committed
open retrieved file in binary mode, since it's now compressed
1 parent fbf648e commit f6218a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/test/test_urllibnet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_fileno(self):
106106
# Make sure fd returned by fileno is valid.
107107
with self.urlopen("http://www.python.org/", timeout=None) as open_url:
108108
fd = open_url.fileno()
109-
with os.fdopen(fd, encoding='utf-8') as f:
109+
with os.fdopen(fd, 'rb') as f:
110110
self.assertTrue(f.read(), "reading from file created using fd "
111111
"returned by fileno failed")
112112

@@ -151,7 +151,7 @@ def test_basic(self):
151151
with self.urlretrieve("http://www.python.org/") as (file_location, info):
152152
self.assertTrue(os.path.exists(file_location), "file location returned by"
153153
" urlretrieve is not a valid path")
154-
with open(file_location, encoding='utf-8') as f:
154+
with open(file_location, 'rb') as f:
155155
self.assertTrue(f.read(), "reading from the file location returned"
156156
" by urlretrieve failed")
157157

@@ -161,7 +161,7 @@ def test_specified_path(self):
161161
support.TESTFN) as (file_location, info):
162162
self.assertEqual(file_location, support.TESTFN)
163163
self.assertTrue(os.path.exists(file_location))
164-
with open(file_location, encoding='utf-8') as f:
164+
with open(file_location, 'rb') as f:
165165
self.assertTrue(f.read(), "reading from temporary file failed")
166166

167167
def test_header(self):

0 commit comments

Comments
 (0)
0