From 9bb76d1b73d4498d87fbe75f23da466c1cb80e98 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Mon, 5 Apr 1999 18:33:40 +0000 Subject: Made the default mode 'rb' instead of 'r', for better cross-platform support. (Based on comment on the documentation by Bernhard Reiter ). --- Lib/gzip.py | 4 ++-- 1 file 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 -- cgit v0.12