Skip to content

Commit 7673357

Browse files
authored
CLN: Remove unused cdef variables (#33122)
Co-authored-by: MomIsBestFriend <>
1 parent 3a29263 commit 7673357

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

pandas/_libs/parsers.pyx

+8-14
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ cdef class TextReader:
267267

268268
cdef:
269269
parser_t *parser
270-
object file_handle, na_fvalues
270+
object na_fvalues
271271
object true_values, false_values
272272
object handle
273273
bint na_filter, keep_default_na, verbose, has_usecols, has_mi_columns
@@ -601,7 +601,6 @@ cdef class TextReader:
601601

602602
cdef _setup_parser_source(self, source):
603603
cdef:
604-
int status
605604
void *ptr
606605

607606
self.parser.cb_io = NULL
@@ -687,7 +686,6 @@ cdef class TextReader:
687686
Py_ssize_t i, start, field_count, passed_count, unnamed_count
688687
char *word
689688
object name, old_name
690-
int status
691689
uint64_t hr, data_line = 0
692690
char *errors = "strict"
693691
StringPath path = _string_path(self.c_encoding)
@@ -837,9 +835,6 @@ cdef class TextReader:
837835
"""
838836
rows=None --> read all rows
839837
"""
840-
cdef:
841-
int status
842-
843838
if self.low_memory:
844839
# Conserve intermediate space
845840
columns = self._read_low_memory(rows)
@@ -888,7 +883,9 @@ cdef class TextReader:
888883
return _concatenate_chunks(chunks)
889884

890885
cdef _tokenize_rows(self, size_t nrows):
891-
cdef int status
886+
cdef:
887+
int status
888+
892889
with nogil:
893890
status = tokenize_nrows(self.parser, nrows)
894891

@@ -1331,7 +1328,8 @@ cdef:
13311328

13321329

13331330
def _ensure_encoded(list lst):
1334-
cdef list result = []
1331+
cdef:
1332+
list result = []
13351333
for x in lst:
13361334
if isinstance(x, str):
13371335
x = PyUnicode_AsUTF8String(x)
@@ -1458,7 +1456,7 @@ cdef _string_box_decode(parser_t *parser, int64_t col,
14581456
bint na_filter, kh_str_starts_t *na_hashset,
14591457
char *encoding):
14601458
cdef:
1461-
int error, na_count = 0
1459+
int na_count = 0
14621460
Py_ssize_t i, size, lines
14631461
coliter_t it
14641462
const char *word = NULL
@@ -1517,7 +1515,7 @@ cdef _categorical_convert(parser_t *parser, int64_t col,
15171515
char *encoding):
15181516
"Convert column data into codes, categories"
15191517
cdef:
1520-
int error, na_count = 0
1518+
int na_count = 0
15211519
Py_ssize_t i, size, lines
15221520
coliter_t it
15231521
const char *word = NULL
@@ -1581,7 +1579,6 @@ cdef _categorical_convert(parser_t *parser, int64_t col,
15811579
cdef _to_fw_string(parser_t *parser, int64_t col, int64_t line_start,
15821580
int64_t line_end, int64_t width):
15831581
cdef:
1584-
const char *word = NULL
15851582
char *data
15861583
ndarray result
15871584

@@ -1767,7 +1764,6 @@ cdef inline int _try_uint64_nogil(parser_t *parser, int64_t col,
17671764
Py_ssize_t i, lines = line_end - line_start
17681765
coliter_t it
17691766
const char *word = NULL
1770-
khiter_t k
17711767

17721768
coliter_setup(&it, parser, col, line_start)
17731769

@@ -1870,9 +1866,7 @@ cdef _try_bool_flex(parser_t *parser, int64_t col,
18701866
Py_ssize_t lines
18711867
uint8_t *data
18721868
ndarray result
1873-
18741869
uint8_t NA = na_values[np.bool_]
1875-
khiter_t k
18761870

18771871
lines = line_end - line_start
18781872
result = np.empty(lines, dtype=np.uint8)

0 commit comments

Comments
 (0)