From 91848deb3073bd93ddd2585660cdaf512d4cb9c1 Mon Sep 17 00:00:00 2001 From: "Michael W. Hudson" Date: Fri, 23 Aug 2002 16:09:52 +0000 Subject: [PATCH] backport montanaro's checkin of revision 1.33 of gzip.py force gzip module to open files using 'b'inary mode. closes patch #536278. This looked like a bugfix candidate to me at some point... --- Lib/gzip.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/gzip.py b/Lib/gzip.py index 7f561532add5..efd072519c90 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: -- 2.47.3