Commit 9f5f65c7 authored by Brian Curtin's avatar Brian Curtin

Fix #10258 - clean up resource warning

parent 810921b6
...@@ -590,7 +590,9 @@ def roundtrip(f): ...@@ -590,7 +590,9 @@ def roundtrip(f):
""" """
if isinstance(f, str): if isinstance(f, str):
f = BytesIO(f.encode('utf-8')) f = BytesIO(f.encode('utf-8'))
try:
token_list = list(tokenize(f.readline)) token_list = list(tokenize(f.readline))
finally:
f.close() f.close()
tokens1 = [tok[:2] for tok in token_list] tokens1 = [tok[:2] for tok in token_list]
new_bytes = untokenize(tokens1) new_bytes = untokenize(tokens1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment