]> granicus.if.org Git - python/commitdiff
Merged revisions 85990 via svnmerge from
authorBrian Curtin <brian.curtin@gmail.com>
Sat, 30 Oct 2010 21:37:28 +0000 (21:37 +0000)
committerBrian Curtin <brian.curtin@gmail.com>
Sat, 30 Oct 2010 21:37:28 +0000 (21:37 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85990 | brian.curtin | 2010-10-30 16:35:28 -0500 (Sat, 30 Oct 2010) | 2 lines

  Fix #10258 - clean up resource warning
........

Lib/test/test_tokenize.py

index 5a25251d9004a2da3440fd7782315e09bc0ea7dc..482af94a323ec0380ed1dccd261c31ef11d4a771 100644 (file)
@@ -592,8 +592,10 @@ def roundtrip(f):
     """
     if isinstance(f, str):
         f = BytesIO(f.encode('utf-8'))
-    token_list = list(tokenize(f.readline))
-    f.close()
+    try:
+        token_list = list(tokenize(f.readline))
+    finally:
+        f.close()
     tokens1 = [tok[:2] for tok in token_list]
     new_bytes = untokenize(tokens1)
     readline = (line for line in new_bytes.splitlines(1)).__next__