mirror of https://github.com/python/cpython
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:
parent
06ca948029
commit
9bb76d1b73
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue