Skip to content

Commit

Permalink
ARROW-12240: [Python] Fix invalid-offsetof warning
Browse files Browse the repository at this point in the history
arrow::csv::ConvertOptions has stl container data members which are
not guaranteed to be standard layout type. It causes invalid-offsetof
warning when compiled with clang-12.

This patch changes directly embedded CCSVConvertOptions to unique_ptr
to fix the issue. Parse and Read options are also updated.

Closes apache#10154 from cyb70289/12240-invalid-offsetof

Lead-authored-by: Yibo Cai <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
  • Loading branch information
2 people authored and michalursa committed Jun 10, 2021
1 parent 9ee2538 commit f04e79d
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 69 deletions.
6 changes: 3 additions & 3 deletions python/pyarrow/_csv.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ from pyarrow.lib cimport _Weakrefable

cdef class ConvertOptions(_Weakrefable):
cdef:
CCSVConvertOptions options
unique_ptr[CCSVConvertOptions] options

@staticmethod
cdef ConvertOptions wrap(CCSVConvertOptions options)


cdef class ParseOptions(_Weakrefable):
cdef:
CCSVParseOptions options
unique_ptr[CCSVParseOptions] options

@staticmethod
cdef ParseOptions wrap(CCSVParseOptions options)


cdef class ReadOptions(_Weakrefable):
cdef:
CCSVReadOptions options
unique_ptr[CCSVReadOptions] options
public object encoding

@staticmethod
Expand Down
Loading

0 comments on commit f04e79d

Please sign in to comment.