Skip to content

Commit 6592c73

Browse files
committed
Do not acquire list as file handler to close
1 parent 7aa5184 commit 6592c73

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/io/parsers.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1766,16 +1766,18 @@ def __init__(self, f, **kwds):
17661766
f = _get_handle(f, 'r', encoding=self.encoding,
17671767
compression=self.compression,
17681768
memory_map=self.memory_map)
1769+
self.handles.append(f)
17691770
elif self.compression:
17701771
f = _wrap_compressed(f, self.compression, self.encoding)
1772+
self.handles.append(f)
17711773
# in Python 3, convert BytesIO or fileobjects passed with an encoding
17721774
elif compat.PY3 and isinstance(f, compat.BytesIO):
17731775
from io import TextIOWrapper
17741776

17751777
f = TextIOWrapper(f, encoding=self.encoding)
1778+
self.handles.append(f)
17761779

17771780
# Set self.data to something that can read lines.
1778-
self.handles.append(f)
17791781
if hasattr(f, 'readline'):
17801782
self._make_reader(f)
17811783
else:

0 commit comments

Comments
 (0)