summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorChris Withers <chris@simplistix.co.uk>2012-11-09 15:48:17 (GMT)
committerChris Withers <chris@simplistix.co.uk>2012-11-09 15:48:17 (GMT)
commit2cc0b07a4c5a4841ebc436698b1c9c2b1a9d8350 (patch)
treead599909b53ed915bb99e177ab54d7dd76338f9d /Lib/gzip.py
parentdc118790de7e608851e646d8b28020122707d31a (diff)
downloadcpython-2cc0b07a4c5a4841ebc436698b1c9c2b1a9d8350.zip
cpython-2cc0b07a4c5a4841ebc436698b1c9c2b1a9d8350.tar.gz
cpython-2cc0b07a4c5a4841ebc436698b1c9c2b1a9d8350.tar.bz2
Bug #16441: avoid excessive memory usage working with large gzip files
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 2ae7c0c..92a7eea 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -421,7 +421,7 @@ class GzipFile(io.BufferedIOBase):
if offset < self.offset:
raise IOError('Negative seek in write mode')
count = offset - self.offset
- for i in range(count // 1024):
+ for i in xrange(count // 1024):
self.write(1024 * '\0')
self.write((count % 1024) * '\0')
elif self.mode == READ:
@@ -429,7 +429,7 @@ class GzipFile(io.BufferedIOBase):
# for negative seek, rewind and do positive seek
self.rewind()
count = offset - self.offset
- for i in range(count // 1024):
+ for i in xrange(count // 1024):
self.read(1024)
self.read(count % 1024)