mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
force gzip module to open files using 'b'inary mode.
closes patch #536278.
This commit is contained in:
parent
d4e5be5340
commit
12424bc0ef
2 changed files with 9 additions and 1 deletions
|
@ -18,7 +18,7 @@ data2 = """/* zlibmodule.c -- gzip-compatible data compression */
|
|||
|
||||
f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close()
|
||||
|
||||
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
|
||||
f = gzip.GzipFile(filename, 'r') ; d = f.read() ; f.close()
|
||||
verify(d == data1*50)
|
||||
|
||||
# Append to the previous file
|
||||
|
@ -75,4 +75,8 @@ for pos in range(0, 256, 16):
|
|||
f.write('GZ\n')
|
||||
f.close()
|
||||
|
||||
f = gzip.GzipFile(filename, 'r')
|
||||
verify(f.myfileobj.mode == 'rb')
|
||||
f.close()
|
||||
|
||||
os.unlink(filename)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue