Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a Python 2.6 regression (GzipFile can't act as a context manager)

  • Loading branch information...
commit c28281f9d60b12e29481214348abc6084c31d77d 1 parent b1ac241
@ambv ambv authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 tests/http_utils/tests.py
View
5 tests/http_utils/tests.py
@@ -11,8 +11,11 @@
# based on Python 3.3's gzip.compress
def gzip_compress(data):
buf = io.BytesIO()
- with gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=0) as f:
+ f = gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=0)
+ try:
f.write(data)
+ finally:
+ f.close()
return buf.getvalue()
Please sign in to comment.
Something went wrong with that request. Please try again.