@@ -171,12 +171,9 @@ cdef extern from "parser/tokenizer.h":
171
171
int64_t skip_first_N_rows
172
172
int64_t skipfooter
173
173
# pick one, depending on whether the converter requires GIL
174
- float64_t (* double_converter_nogil)(const char * , char ** ,
175
- char , char , char ,
176
- int , int * , int * ) nogil
177
- float64_t (* double_converter_withgil)(const char * , char ** ,
178
- char , char , char ,
179
- int , int * , int * )
174
+ float64_t (* double_converter)(const char * , char ** ,
175
+ char , char , char ,
176
+ int , int * , int * ) nogil
180
177
181
178
# error handling
182
179
char * warn_msg
@@ -469,16 +466,11 @@ cdef class TextReader:
469
466
470
467
if float_precision == " round_trip" :
471
468
# see gh-15140
472
- #
473
- # Our current roundtrip implementation requires the GIL.
474
- self .parser.double_converter_nogil = NULL
475
- self .parser.double_converter_withgil = round_trip
469
+ self .parser.double_converter = round_trip
476
470
elif float_precision == " high" :
477
- self .parser.double_converter_withgil = NULL
478
- self .parser.double_converter_nogil = precise_xstrtod
471
+ self .parser.double_converter = precise_xstrtod
479
472
else :
480
- self .parser.double_converter_withgil = NULL
481
- self .parser.double_converter_nogil = xstrtod
473
+ self .parser.double_converter = xstrtod
482
474
483
475
if isinstance (dtype, dict ):
484
476
dtype = {k: pandas_dtype(dtype[k])
@@ -1663,22 +1655,12 @@ cdef _try_double(parser_t *parser, int64_t col,
1663
1655
result = np.empty(lines, dtype = np.float64)
1664
1656
data = < float64_t * > result.data
1665
1657
na_fset = kset_float64_from_list(na_flist)
1666
- if parser.double_converter_nogil != NULL : # if it can run without the GIL
1667
- with nogil:
1668
- error = _try_double_nogil(parser, parser.double_converter_nogil,
1669
- col, line_start, line_end,
1670
- na_filter, na_hashset, use_na_flist,
1671
- na_fset, NA, data, & na_count)
1672
- else :
1673
- assert parser.double_converter_withgil != NULL
1674
- error = _try_double_nogil(parser,
1675
- < float64_t (* )(const char * , char ** ,
1676
- char , char , char ,
1677
- int , int * , int * )
1678
- nogil> parser.double_converter_withgil,
1658
+ with nogil:
1659
+ error = _try_double_nogil(parser, parser.double_converter,
1679
1660
col, line_start, line_end,
1680
1661
na_filter, na_hashset, use_na_flist,
1681
1662
na_fset, NA, data, & na_count)
1663
+
1682
1664
kh_destroy_float64(na_fset)
1683
1665
if error != 0 :
1684
1666
return None , None
0 commit comments