@@ -1700,7 +1700,6 @@ def read(
17001700 if (self ._nobs == 0 ) and (nrows is None ):
17011701 self ._can_read_value_labels = True
17021702 self ._data_read = True
1703- self .close ()
17041703 return DataFrame (columns = self ._varlist )
17051704
17061705 # Handle options
@@ -1737,7 +1736,6 @@ def read(
17371736 # we are reading the file incrementally
17381737 if convert_categoricals :
17391738 self ._read_value_labels ()
1740- self .close ()
17411739 raise StopIteration
17421740 offset = self ._lines_read * dtype .itemsize
17431741 self ._path_or_buf .seek (self ._data_location + offset )
@@ -1770,11 +1768,7 @@ def read(
17701768 data .index = Index (rng ) # set attr instead of set_index to avoid copy
17711769
17721770 if columns is not None :
1773- try :
1774- data = self ._do_select_columns (data , columns )
1775- except ValueError :
1776- self .close ()
1777- raise
1771+ data = self ._do_select_columns (data , columns )
17781772
17791773 # Decode strings
17801774 for col , typ in zip (data , self ._typlist ):
@@ -1813,13 +1807,9 @@ def any_startswith(x: str) -> bool:
18131807 cols = np .where ([any_startswith (x ) for x in self ._fmtlist ])[0 ]
18141808 for i in cols :
18151809 col = data .columns [i ]
1816- try :
1817- data [col ] = _stata_elapsed_date_to_datetime_vec (
1818- data [col ], self ._fmtlist [i ]
1819- )
1820- except ValueError :
1821- self .close ()
1822- raise
1810+ data [col ] = _stata_elapsed_date_to_datetime_vec (
1811+ data [col ], self ._fmtlist [i ]
1812+ )
18231813
18241814 if convert_categoricals and self ._format_version > 108 :
18251815 data = self ._do_convert_categoricals (
0 commit comments