@@ -121,30 +121,30 @@ cdef extern from "parser/tokenizer.h":
121
121
io_callback cb_io
122
122
io_cleanup cb_cleanup
123
123
124
- int chunksize # Number of bytes to prepare for each chunk
124
+ size_t chunksize # Number of bytes to prepare for each chunk
125
125
char * data # pointer to data to be processed
126
- int datalen # amount of data available
127
- int datapos
126
+ size_t datalen # amount of data available
127
+ size_t datapos
128
128
129
129
# where to write out tokenized data
130
130
char * stream
131
- int stream_len
132
- int stream_cap
131
+ size_t stream_len
132
+ size_t stream_cap
133
133
134
134
# Store words in (potentially ragged) matrix for now, hmm
135
135
char ** words
136
- int * word_starts # where we are in the stream
137
- int words_len
138
- int words_cap
136
+ size_t * word_starts # where we are in the stream
137
+ size_t words_len
138
+ size_t words_cap
139
139
140
140
char * pword_start # pointer to stream start of current field
141
- int word_start # position start of current field
141
+ size_t word_start # position start of current field
142
142
143
- int * line_start # position in words for start of line
144
- int * line_fields # Number of fields in each line
145
- int lines # Number of lines observed
146
- int file_lines # Number of file lines observed (with bad/skipped)
147
- int lines_cap # Vector capacity
143
+ size_t * line_start # position in words for start of line
144
+ size_t * line_fields # Number of fields in each line
145
+ size_t lines # Number of lines observed
146
+ size_t file_lines # Number of file lines observed (with bad/skipped)
147
+ size_t lines_cap # Vector capacity
148
148
149
149
# Tokenizing stuff
150
150
ParserState state
@@ -178,13 +178,13 @@ cdef extern from "parser/tokenizer.h":
178
178
char thousands
179
179
180
180
int header # Boolean: 1: has header, 0: no header
181
- int header_start # header row start
182
- int header_end # header row end
181
+ ssize_t header_start # header row start
182
+ ssize_t header_end # header row end
183
183
184
184
void * skipset
185
185
PyObject * skipfunc
186
186
int64_t skip_first_N_rows
187
- int skipfooter
187
+ size_t skipfooter
188
188
# pick one, depending on whether the converter requires GIL
189
189
double (* double_converter_nogil)(const char * , char ** ,
190
190
char , char , char , int ) nogil
@@ -195,12 +195,12 @@ cdef extern from "parser/tokenizer.h":
195
195
char * warn_msg
196
196
char * error_msg
197
197
198
- int skip_empty_lines
198
+ size_t skip_empty_lines
199
199
200
200
ctypedef struct coliter_t:
201
201
char ** words
202
- int * line_start
203
- int col
202
+ size_t * line_start
203
+ size_t col
204
204
205
205
ctypedef struct uint_state:
206
206
int seen_sint
@@ -210,7 +210,7 @@ cdef extern from "parser/tokenizer.h":
210
210
void uint_state_init(uint_state * self )
211
211
int uint64_conflict(uint_state * self )
212
212
213
- void coliter_setup(coliter_t * it, parser_t * parser, int i, int start) nogil
213
+ void coliter_setup(coliter_t * it, parser_t * parser, size_t i, size_t start) nogil
214
214
void COLITER_NEXT(coliter_t, const char * ) nogil
215
215
216
216
parser_t* parser_new()
@@ -289,14 +289,14 @@ cdef class TextReader:
289
289
object true_values, false_values
290
290
object handle
291
291
bint na_filter, verbose, has_usecols, has_mi_columns
292
- int parser_start
292
+ size_t parser_start
293
293
list clocks
294
294
char * c_encoding
295
295
kh_str_t * false_set
296
296
kh_str_t * true_set
297
297
298
298
cdef public:
299
- int leading_cols, table_width, skipfooter, buffer_lines
299
+ size_t leading_cols, table_width, skipfooter, buffer_lines
300
300
object allow_leading_cols
301
301
object delimiter, converters, delim_whitespace
302
302
object na_values
@@ -730,7 +730,8 @@ cdef class TextReader:
730
730
Py_ssize_t i, start, field_count, passed_count, unnamed_count # noqa
731
731
char * word
732
732
object name
733
- int status, hr, data_line
733
+ int status
734
+ size_t hr, data_line
734
735
char * errors = " strict"
735
736
cdef StringPath path = _string_path(self .c_encoding)
736
737
@@ -949,8 +950,8 @@ cdef class TextReader:
949
950
950
951
cdef _read_rows(self , rows, bint trim):
951
952
cdef:
952
- int buffered_lines
953
- int irows, footer = 0
953
+ size_t buffered_lines
954
+ size_t irows, footer = 0
954
955
955
956
self ._start_clock()
956
957
@@ -1018,12 +1019,13 @@ cdef class TextReader:
1018
1019
1019
1020
def _convert_column_data (self , rows = None , upcast_na = False , footer = 0 ):
1020
1021
cdef:
1021
- Py_ssize_t i, nused
1022
+ size_t i
1023
+ int nused
1022
1024
kh_str_t * na_hashset = NULL
1023
- int start, end
1025
+ size_t start, end
1024
1026
object name, na_flist, col_dtype = None
1025
1027
bint na_filter = 0
1026
- Py_ssize_t num_cols
1028
+ size_t num_cols
1027
1029
1028
1030
start = self .parser_start
1029
1031
@@ -1036,7 +1038,7 @@ cdef class TextReader:
1036
1038
# if footer > 0:
1037
1039
# end -= footer
1038
1040
1039
- num_cols = - 1
1041
+ num_cols = 0
1040
1042
for i in range (self .parser.lines):
1041
1043
num_cols = (num_cols < self .parser.line_fields[i]) * \
1042
1044
self .parser.line_fields[i] + \
@@ -1195,7 +1197,7 @@ cdef class TextReader:
1195
1197
return col_res, na_count
1196
1198
1197
1199
cdef _convert_with_dtype(self , object dtype, Py_ssize_t i,
1198
- int start, int end,
1200
+ size_t start, size_t end,
1199
1201
bint na_filter,
1200
1202
bint user_dtype,
1201
1203
kh_str_t * na_hashset,
@@ -1275,7 +1277,7 @@ cdef class TextReader:
1275
1277
raise TypeError (" the dtype %s is not "
1276
1278
" supported for parsing" % dtype)
1277
1279
1278
- cdef _string_convert(self , Py_ssize_t i, int start, int end,
1280
+ cdef _string_convert(self , Py_ssize_t i, size_t start, size_t end,
1279
1281
bint na_filter, kh_str_t * na_hashset):
1280
1282
1281
1283
cdef StringPath path = _string_path(self .c_encoding)
@@ -1336,6 +1338,7 @@ cdef class TextReader:
1336
1338
kh_destroy_str(table)
1337
1339
1338
1340
cdef _get_column_name(self , Py_ssize_t i, Py_ssize_t nused):
1341
+ cdef int j
1339
1342
if self .has_usecols and self .names is not None :
1340
1343
if (not callable (self .usecols) and
1341
1344
len (self .names) == len (self .usecols)):
@@ -1427,8 +1430,8 @@ cdef inline StringPath _string_path(char *encoding):
1427
1430
# ----------------------------------------------------------------------
1428
1431
# Type conversions / inference support code
1429
1432
1430
- cdef _string_box_factorize(parser_t * parser, int col,
1431
- int line_start, int line_end,
1433
+ cdef _string_box_factorize(parser_t * parser, size_t col,
1434
+ size_t line_start, size_t line_end,
1432
1435
bint na_filter, kh_str_t * na_hashset):
1433
1436
cdef:
1434
1437
int error, na_count = 0
@@ -1480,8 +1483,8 @@ cdef _string_box_factorize(parser_t *parser, int col,
1480
1483
1481
1484
return result, na_count
1482
1485
1483
- cdef _string_box_utf8(parser_t * parser, int col,
1484
- int line_start, int line_end,
1486
+ cdef _string_box_utf8(parser_t * parser, size_t col,
1487
+ size_t line_start, size_t line_end,
1485
1488
bint na_filter, kh_str_t * na_hashset):
1486
1489
cdef:
1487
1490
int error, na_count = 0
@@ -1533,8 +1536,8 @@ cdef _string_box_utf8(parser_t *parser, int col,
1533
1536
1534
1537
return result, na_count
1535
1538
1536
- cdef _string_box_decode(parser_t * parser, int col,
1537
- int line_start, int line_end,
1539
+ cdef _string_box_decode(parser_t * parser, size_t col,
1540
+ size_t line_start, size_t line_end,
1538
1541
bint na_filter, kh_str_t * na_hashset,
1539
1542
char * encoding):
1540
1543
cdef:
@@ -1592,8 +1595,8 @@ cdef _string_box_decode(parser_t *parser, int col,
1592
1595
1593
1596
1594
1597
@ cython.boundscheck (False )
1595
- cdef _categorical_convert(parser_t * parser, int col,
1596
- int line_start, int line_end,
1598
+ cdef _categorical_convert(parser_t * parser, size_t col,
1599
+ size_t line_start, size_t line_end,
1597
1600
bint na_filter, kh_str_t * na_hashset,
1598
1601
char * encoding):
1599
1602
" Convert column data into codes, categories"
@@ -1663,8 +1666,8 @@ cdef _categorical_convert(parser_t *parser, int col,
1663
1666
kh_destroy_str(table)
1664
1667
return np.asarray(codes), result, na_count
1665
1668
1666
- cdef _to_fw_string(parser_t * parser, int col, int line_start,
1667
- int line_end, size_t width):
1669
+ cdef _to_fw_string(parser_t * parser, size_t col, size_t line_start,
1670
+ size_t line_end, size_t width):
1668
1671
cdef:
1669
1672
Py_ssize_t i
1670
1673
coliter_t it
@@ -1680,11 +1683,11 @@ cdef _to_fw_string(parser_t *parser, int col, int line_start,
1680
1683
1681
1684
return result
1682
1685
1683
- cdef inline void _to_fw_string_nogil(parser_t * parser, int col,
1684
- int line_start, int line_end,
1686
+ cdef inline void _to_fw_string_nogil(parser_t * parser, size_t col,
1687
+ size_t line_start, size_t line_end,
1685
1688
size_t width, char * data) nogil:
1686
1689
cdef:
1687
- Py_ssize_t i
1690
+ size_t i
1688
1691
coliter_t it
1689
1692
const char * word = NULL
1690
1693
@@ -1699,7 +1702,7 @@ cdef char* cinf = b'inf'
1699
1702
cdef char * cposinf = b' +inf'
1700
1703
cdef char * cneginf = b' -inf'
1701
1704
1702
- cdef _try_double(parser_t * parser, int col, int line_start, int line_end,
1705
+ cdef _try_double(parser_t * parser, size_t col, size_t line_start, size_t line_end,
1703
1706
bint na_filter, kh_str_t * na_hashset, object na_flist):
1704
1707
cdef:
1705
1708
int error, na_count = 0
@@ -1808,7 +1811,7 @@ cdef inline int _try_double_nogil(parser_t *parser,
1808
1811
1809
1812
return 0
1810
1813
1811
- cdef _try_uint64(parser_t * parser, int col, int line_start, int line_end,
1814
+ cdef _try_uint64(parser_t * parser, size_t col, size_t line_start, size_t line_end,
1812
1815
bint na_filter, kh_str_t * na_hashset):
1813
1816
cdef:
1814
1817
int error
@@ -1842,8 +1845,8 @@ cdef _try_uint64(parser_t *parser, int col, int line_start, int line_end,
1842
1845
1843
1846
return result
1844
1847
1845
- cdef inline int _try_uint64_nogil(parser_t * parser, int col, int line_start,
1846
- int line_end, bint na_filter,
1848
+ cdef inline int _try_uint64_nogil(parser_t * parser, size_t col, size_t line_start,
1849
+ size_t line_end, bint na_filter,
1847
1850
const kh_str_t * na_hashset,
1848
1851
uint64_t * data, uint_state * state) nogil:
1849
1852
cdef:
@@ -1879,7 +1882,7 @@ cdef inline int _try_uint64_nogil(parser_t *parser, int col, int line_start,
1879
1882
1880
1883
return 0
1881
1884
1882
- cdef _try_int64(parser_t * parser, int col, int line_start, int line_end,
1885
+ cdef _try_int64(parser_t * parser, size_t col, size_t line_start, size_t line_end,
1883
1886
bint na_filter, kh_str_t * na_hashset):
1884
1887
cdef:
1885
1888
int error, na_count = 0
@@ -1906,8 +1909,8 @@ cdef _try_int64(parser_t *parser, int col, int line_start, int line_end,
1906
1909
1907
1910
return result, na_count
1908
1911
1909
- cdef inline int _try_int64_nogil(parser_t * parser, int col, int line_start,
1910
- int line_end, bint na_filter,
1912
+ cdef inline int _try_int64_nogil(parser_t * parser, size_t col, size_t line_start,
1913
+ size_t line_end, bint na_filter,
1911
1914
const kh_str_t * na_hashset, int64_t NA,
1912
1915
int64_t * data, int * na_count) nogil:
1913
1916
cdef:
@@ -1944,7 +1947,7 @@ cdef inline int _try_int64_nogil(parser_t *parser, int col, int line_start,
1944
1947
1945
1948
return 0
1946
1949
1947
- cdef _try_bool(parser_t * parser, int col, int line_start, int line_end,
1950
+ cdef _try_bool(parser_t * parser, size_t col, size_t line_start, size_t line_end,
1948
1951
bint na_filter, kh_str_t * na_hashset):
1949
1952
cdef:
1950
1953
int na_count
@@ -1966,8 +1969,8 @@ cdef _try_bool(parser_t *parser, int col, int line_start, int line_end,
1966
1969
return None , None
1967
1970
return result.view(np.bool_), na_count
1968
1971
1969
- cdef inline int _try_bool_nogil(parser_t * parser, int col, int line_start,
1970
- int line_end, bint na_filter,
1972
+ cdef inline int _try_bool_nogil(parser_t * parser, size_t col, size_t line_start,
1973
+ size_t line_end, bint na_filter,
1971
1974
const kh_str_t * na_hashset, uint8_t NA,
1972
1975
uint8_t * data, int * na_count) nogil:
1973
1976
cdef:
@@ -2006,7 +2009,7 @@ cdef inline int _try_bool_nogil(parser_t *parser, int col, int line_start,
2006
2009
data += 1
2007
2010
return 0
2008
2011
2009
- cdef _try_bool_flex(parser_t * parser, int col, int line_start, int line_end,
2012
+ cdef _try_bool_flex(parser_t * parser, size_t col, size_t line_start, size_t line_end,
2010
2013
bint na_filter, const kh_str_t * na_hashset,
2011
2014
const kh_str_t * true_hashset,
2012
2015
const kh_str_t * false_hashset):
@@ -2032,8 +2035,8 @@ cdef _try_bool_flex(parser_t *parser, int col, int line_start, int line_end,
2032
2035
return None , None
2033
2036
return result.view(np.bool_), na_count
2034
2037
2035
- cdef inline int _try_bool_flex_nogil(parser_t * parser, int col, int line_start,
2036
- int line_end, bint na_filter,
2038
+ cdef inline int _try_bool_flex_nogil(parser_t * parser, size_t col, size_t line_start,
2039
+ size_t line_end, bint na_filter,
2037
2040
const kh_str_t * na_hashset,
2038
2041
const kh_str_t * true_hashset,
2039
2042
const kh_str_t * false_hashset,
@@ -2251,8 +2254,8 @@ for k in list(na_values):
2251
2254
na_values[np.dtype(k)] = na_values[k]
2252
2255
2253
2256
2254
- cdef _apply_converter(object f, parser_t * parser, int col,
2255
- int line_start, int line_end,
2257
+ cdef _apply_converter(object f, parser_t * parser, size_t col,
2258
+ size_t line_start, size_t line_end,
2256
2259
char * c_encoding):
2257
2260
cdef:
2258
2261
int error
@@ -2296,7 +2299,7 @@ def _to_structured_array(dict columns, object names, object usecols):
2296
2299
2297
2300
object name, fnames, field_type
2298
2301
Py_ssize_t i, offset, nfields, length
2299
- int stride, elsize
2302
+ size_t stride, elsize
2300
2303
char * buf
2301
2304
2302
2305
if names is None :
@@ -2344,10 +2347,10 @@ def _to_structured_array(dict columns, object names, object usecols):
2344
2347
2345
2348
return recs
2346
2349
2347
- cdef _fill_structured_column(char * dst, char * src, int elsize,
2348
- int stride, int length, bint incref):
2350
+ cdef _fill_structured_column(char * dst, char * src, size_t elsize,
2351
+ size_t stride, size_t length, bint incref):
2349
2352
cdef:
2350
- Py_ssize_t i
2353
+ size_t i
2351
2354
2352
2355
if incref:
2353
2356
util.transfer_object_column(dst, src, stride, length)
0 commit comments