summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-02-02 16:51:06 (GMT)
committerGuido van Rossum <guido@python.org>2000-02-02 16:51:06 (GMT)
commit5606801b64e9e4a599eb416ec6a0c19b5e27a092 (patch)
treede77afe8ff44d421260cd664afd788b7113547cc /Lib/gzip.py
parent4acc25bd392216c4f867a10ca8081e7c8a739676 (diff)
downloadcpython-5606801b64e9e4a599eb416ec6a0c19b5e27a092.zip
cpython-5606801b64e9e4a599eb416ec6a0c19b5e27a092.tar.gz
cpython-5606801b64e9e4a599eb416ec6a0c19b5e27a092.tar.bz2
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).
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index c0aff91..0ba2ac2 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -139,12 +139,12 @@ class GzipFile:
def writelines(self,lines):
self.write(string.join(lines))
- def read(self, size=None):
+ def read(self, size=-1):
if self.extrasize <= 0 and self.fileobj is None:
return ''
readsize = 1024
- if not size: # get the whole thing
+ if size < 0: # get the whole thing
try:
while 1:
self._read(readsize)
@@ -281,7 +281,7 @@ class GzipFile:
bufs.append(c)
readsize = readsize * 2
- def readlines(self):
+ def readlines(self, ignored=None):
buf = self.read()
lines = string.split(buf, '\n')
for i in range(len(lines)-1):