Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit c28281f9d60b12e29481214348abc6084c31d77d 1 parent b1ac241
Łukasz Langa authored May 21, 2013

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. 5  tests/http_utils/tests.py
5  tests/http_utils/tests.py
@@ -11,8 +11,11 @@
11 11
 # based on Python 3.3's gzip.compress
12 12
 def gzip_compress(data):
13 13
     buf = io.BytesIO()
14  
-    with gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=0) as f:
  14
+    f = gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=0)
  15
+    try:
15 16
         f.write(data)
  17
+    finally:
  18
+        f.close()
16 19
     return buf.getvalue()
17 20
 
18 21
 

0 notes on commit c28281f

Please sign in to comment.
Something went wrong with that request. Please try again.