Close bz2 file object in Python 2 · pandas-dev/pandas@376dce3 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 376dce3

Close bz2 file object in Python 2

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -324,6 +324,7 @@ def _get_handle(path_or_buf, mode, encoding=None, compression=None,
324 324 # Python 2's bz2 module can't take file objects, so have to
325 325 # run through decompress manually
326 326 f = StringIO(bz2.decompress(path_or_buf.read()))
327 +path_or_buf.close()
327 328 else:
328 329 f = bz2.BZ2File(path_or_buf)
329 330