Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 052364b

Browse files
committed
Use binary mode for all gzip files we open.
1 parent 00b6d0f commit 052364b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/test/test_gzip.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
/* See http://www.winimage.com/zLibDll for Windows */
1717
"""
1818

19-
f = gzip.GzipFile(filename, 'w') ; f.write(data1) ; f.close()
19+
f = gzip.GzipFile(filename, 'wb') ; f.write(data1) ; f.close()
2020

21-
f = gzip.GzipFile(filename, 'r') ; d = f.read() ; f.close()
21+
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
2222
assert d == data1
2323

2424
# Append to the previous file
25-
f = gzip.GzipFile(filename, 'a') ; f.write(data2) ; f.close()
25+
f = gzip.GzipFile(filename, 'ab') ; f.write(data2) ; f.close()
2626

27-
f = gzip.GzipFile(filename, 'r') ; d = f.read() ; f.close()
27+
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
2828
assert d == data1+data2
2929

3030
os.unlink( filename )

0 commit comments

Comments
 (0)