[Python-checkins] python/dist/src/Lib gzip.py,1.32,1.33

montanaro@sourceforge.net montanaro@sourceforge.net
Wed, 22 May 2002 18:43:07 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv15685

Modified Files:
	gzip.py 
Log Message:
force gzip module to open files using 'b'inary mode.
closes patch #536278.


Index: gzip.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** gzip.py	16 Apr 2002 01:38:39 -0000	1.32
--- gzip.py	23 May 2002 01:43:04 -0000	1.33
***************
*** 36,39 ****
--- 36,43 ----
      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')