Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.32 diff -c -r1.32 gzip.py *** gzip.py 16 Apr 2002 01:38:39 -0000 1.32 --- gzip.py 22 May 2002 01:31:36 -0000 *************** *** 35,40 **** --- 35,44 ---- def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None): + # guarantee the file is opened in binary mode on platforms + # that care about that sort of thing + if mode and 'b' not in mode: + mode += 'b' if fileobj is None: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') if filename is None: Index: test/test_gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gzip.py,v retrieving revision 1.8 diff -c -r1.8 test_gzip.py *** test/test_gzip.py 9 Aug 2001 21:40:30 -0000 1.8 --- test/test_gzip.py 22 May 2002 01:31:36 -0000 *************** *** 18,24 **** f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close() ! f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close() verify(d == data1*50) # Append to the previous file --- 18,24 ---- f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close() ! f = gzip.GzipFile(filename, 'r') ; d = f.read() ; f.close() verify(d == data1*50) # Append to the previous file *************** *** 73,78 **** --- 73,82 ---- for pos in range(0, 256, 16): f.seek(pos) f.write('GZ\n') + f.close() + + f = gzip.GzipFile(filename, 'r') + verify(f.myfileobj.mode == 'rb') f.close() os.unlink(filename)