summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-04-05 18:33:40 (GMT)
committerFred Drake <fdrake@acm.org>1999-04-05 18:33:40 (GMT)
commit9bb76d1b73d4498d87fbe75f23da466c1cb80e98 (patch)
tree907919351b58dc0c2c56a8b129d473c8f31ea152
parent06ca948029492e277896e06fba3d9255ed2430c3 (diff)
downloadcpython-9bb76d1b73d4498d87fbe75f23da466c1cb80e98.zip
cpython-9bb76d1b73d4498d87fbe75f23da466c1cb80e98.tar.gz
cpython-9bb76d1b73d4498d87fbe75f23da466c1cb80e98.tar.bz2
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>).
-rw-r--r--Lib/gzip.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index c0179a4..793bf5c 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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