Skip to content

Commit 8fa751e

Browse files
Add TypeError and ValueError to the list of caught exceptions
Also add a comment why combining tm.ensure_clean and td.check_file_leaks don't play along nicely together
1 parent 996d474 commit 8fa751e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pandas/io/parsers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,7 @@ def __init__(self, f, **kwds):
22792279
self.num_original_columns,
22802280
self.unnamed_cols,
22812281
) = self._infer_columns()
2282-
except EmptyDataError:
2282+
except (TypeError, ValueError):
22832283
self.close()
22842284
raise
22852285

pandas/tests/io/parser/test_common.py

+3
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,9 @@ def test_integer_precision(all_parsers):
20852085
@td.skip_if_no("psutil")
20862086
def test_file_descriptor_leak(all_parsers):
20872087
# GH 31488
2088+
# Please note that using tm.ensure_clean does not work in combination
2089+
# with td.check_file_leaks as tm.ensure_clean closes the file
2090+
# thereby preventing the leak check to trigger
20882091
import psutil
20892092

20902093
proc = psutil.Process()

0 commit comments

Comments
 (0)