From: Michael W. Hudson Date: Fri, 23 Aug 2002 16:09:52 +0000 (+0000) Subject: backport montanaro's checkin of X-Git-Tag: v2.2.2b1~200 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=91848deb3073bd93ddd2585660cdaf512d4cb9c1;p=thirdparty%2FPython%2Fcpython.git 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... --- 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: