diff options
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r-- | Lib/gzip.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py index b2bbeda3e8..9e198c75d5 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -35,6 +35,10 @@ class GzipFile: def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None): + # guarantee the file is opened in binary mode on platforms + # that care about that sort of thing + if mode and 'b' not in mode: + mode += 'b' if fileobj is None: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') if filename is None: |