[Python-checkins] CVS: python/dist/src/Lib gzip.py,1.14,1.15
Guido van Rossum
guido@cnri.reston.va.us
Wed, 2 Feb 2000 11:51:09 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Lib
In directory eric:/projects/python/develop/guido/src/Lib
Modified Files:
gzip.py
Log Message:
Make read() and readlines() conform more to the file object interface:
the default arg for read() is -1, not None, and readlines() has an
optional argument (which for now is ignored).
Index: gzip.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/gzip.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** gzip.py 1999/09/06 16:34:51 1.14
--- gzip.py 2000/02/02 16:51:06 1.15
***************
*** 140,149 ****
self.write(string.join(lines))
! def read(self, size=None):
if self.extrasize <= 0 and self.fileobj is None:
return ''
readsize = 1024
! if not size: # get the whole thing
try:
while 1:
--- 140,149 ----
self.write(string.join(lines))
! def read(self, size=-1):
if self.extrasize <= 0 and self.fileobj is None:
return ''
readsize = 1024
! if size < 0: # get the whole thing
try:
while 1:
***************
*** 282,286 ****
readsize = readsize * 2
! def readlines(self):
buf = self.read()
lines = string.split(buf, '\n')
--- 282,286 ----
readsize = readsize * 2
! def readlines(self, ignored=None):
buf = self.read()
lines = string.split(buf, '\n')