[Python-checkins] python/dist/src/Lib gzip.py,1.28,1.28.10.1

mwh@users.sourceforge.net mwh@users.sourceforge.net
2002年8月23日 09:09:56 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13606
Modified Files:
 Tag: release22-maint
	gzip.py 
Log Message:
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...
Index: gzip.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v
retrieving revision 1.28
retrieving revision 1.28.10.1
diff -C2 -d -r1.28 -r1.28.10.1
*** gzip.py	13 Oct 2001 18:33:51 -0000	1.28
--- gzip.py	23 Aug 2002 16:09:52 -0000	1.28.10.1
***************
*** 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')

AltStyle によって変換されたページ (->オリジナル) /