diff options
author | Florian Weimer <fw@deneb.enyo.de> | 2012-08-06 19:39:30 +0000 |
---|---|---|
committer | Florian Weimer <fw@deneb.enyo.de> | 2012-08-06 19:39:30 +0000 |
commit | bdb60a82725f316c8daf47c1c4fa86cfd27a3551 (patch) | |
tree | 1faae44ea2e91d53f0157221efaeeb145a1f812b /lib | |
parent | d2af65cd27972b830130eeb2afb0c907234bbd14 (diff) |
lib/python/debian_support.py: avoid GzipFile context manager
It is not available in Python 2.6.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@19904 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/debian_support.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py index 7979a6bdca..035f8d2097 100644 --- a/lib/python/debian_support.py +++ b/lib/python/debian_support.py @@ -289,8 +289,14 @@ def downloadGunzipLines(remote): Returns the lines in the file.""" data = urllib2.urlopen(remote, timeout=TIMEOUT) - with gzip.GzipFile(fileobj=StringIO(data.read())) as gfile: - return gfile.readlines() + try: + gfile = gzip.GzipFile(fileobj=StringIO(data.read())) + try: + return gfile.readlines() + finally: + gfile.close() + finally: + data.close() def downloadFile(remote, local): """Copies a gzipped remote file to the local system. |