Made the default mode 'rb' instead of 'r', for better cross-platform

support.  (Based on comment on the documentation by Bernhard Reiter
<bernhard@csd.uwm.edu>).
This commit is contained in:
Fred Drake 1999-04-05 18:33:40 +00:00
parent 06ca948029
commit 9bb76d1b73
1 changed files with 2 additions and 2 deletions

View File

@ -30,13 +30,13 @@ class GzipFile:
def __init__(self, filename=None, mode=None,
compresslevel=9, fileobj=None):
if fileobj is None:
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'r')
fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
if filename is None:
if hasattr(fileobj, 'name'): filename = fileobj.name
else: filename = ''
if mode is None:
if hasattr(fileobj, 'mode'): mode = fileobj.mode
else: mode = 'r'
else: mode = 'rb'
if mode[0:1] == 'r':
self.mode = READ