Skip to content

Fix SEGV when using skip lines #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
10 changes: 8 additions & 2 deletions pandas/parser.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ cdef class TextReader:
cdef:
size_t rows_read = 0
chunks = []
int status

if rows is None:
while True:
Expand All @@ -747,7 +748,9 @@ cdef class TextReader:
else:
chunks.append(chunk)

parser_trim_buffers(self.parser)
status = parser_trim_buffers(self.parser)
if status < 0:
raise_parser_error('Error trimming data', self.parser)

if len(chunks) == 0:
raise StopIteration
Expand Down Expand Up @@ -812,7 +815,10 @@ cdef class TextReader:
# trim
parser_consume_rows(self.parser, rows_read)
if trim:
parser_trim_buffers(self.parser)
status = parser_trim_buffers(self.parser)

if status < 0:
raise_parser_error('Error trimming data', self.parser)
self.parser_start -= rows_read

self._end_clock('Parser memory cleanup')
Expand Down
Loading