diff --git a/python/pyarrow/_csv.pyx b/python/pyarrow/_csv.pyx index d1db03c75f1fa..16bd0985e2346 100644 --- a/python/pyarrow/_csv.pyx +++ b/python/pyarrow/_csv.pyx @@ -550,12 +550,12 @@ cdef class ParseOptions(_Weakrefable): def __getstate__(self): return (self.delimiter, self.quote_char, self.double_quote, self.escape_char, self.newlines_in_values, - self.ignore_empty_lines, self._invalid_row_handler) + self.ignore_empty_lines, self.invalid_row_handler) def __setstate__(self, state): (self.delimiter, self.quote_char, self.double_quote, self.escape_char, self.newlines_in_values, - self.ignore_empty_lines, self._invalid_row_handler) = state + self.ignore_empty_lines, self.invalid_row_handler) = state def __eq__(self, other): try: diff --git a/python/pyarrow/tests/test_csv.py b/python/pyarrow/tests/test_csv.py index 3be6f07bfece6..c8ae9ff15d1bd 100644 --- a/python/pyarrow/tests/test_csv.py +++ b/python/pyarrow/tests/test_csv.py @@ -654,6 +654,16 @@ def row_num(x): expected_rows = [InvalidRow(2, 1, row_num(2), "c")] assert parse_opts.invalid_row_handler.rows == expected_rows + # Test ser/de + parse_opts.invalid_row_handler = InvalidRowHandler('skip') + parse_opts = pickle.loads(pickle.dumps(parse_opts)) + + table = self.read_bytes(rows, parse_options=parse_opts) + assert table.to_pydict() == { + 'a': ["d", "i"], + 'b': ["e", "j"], + } + class BaseCSVTableRead(BaseTestCSV):