Commit 9bb76d1b authored by Fred Drake's avatar Fred Drake

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>).
parent 06ca9480
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment