From: Chris Withers Date: Fri, 9 Nov 2012 15:48:17 +0000 (+0000) Subject: Bug #16441: avoid excessive memory usage working with large gzip files X-Git-Tag: v2.7.4rc1~396 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2cc0b07a4c5a4841ebc436698b1c9c2b1a9d8350;p=thirdparty%2FPython%2Fcpython.git Bug #16441: avoid excessive memory usage working with large gzip files --- diff --git a/Lib/gzip.py b/Lib/gzip.py index 2ae7c0cffe38..92a7eea0bcdd 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) diff --git a/Misc/NEWS b/Misc/NEWS index d8821b0e5cad..381b1fced929 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -464,6 +464,9 @@ Library - Issue #6884: Fix long-standing bugs with MANIFEST.in parsing in distutils on Windows. +- Issue #16441: Avoid excessive memory usage working with large gzip + files using the gzip module. + Extension Modules -----------------