Uh oh!
There was an error while loading. Please reload this page.
ARROW-11299: [Python] Fix invalid-offsetof warnings - #9274
Conversation
bkietz
commented
Jan 20, 2021
@cyb70289 |
bkietz
commented
Jan 20, 2021
I think the best way to resolve this issue is to avoid direct instances of derived classes of FunctionOptions in Cython, since Cython inappropriately applies I'd recommend the following approach: rewrite
cdefclassFunctionOptions(_Weakrefable):
cdef:
shared_ptr[CFunctionOptions] optionscdefconstCFunctionOptions*get_options(self) exceptNULL
cdefclass_CastOptions(FunctionOptions):
cdef:
constCCastOptions*cast_options__slots__= () # avoid mistakingly creating attributescdefconstCFunctionOptions*get_options(self) exceptNULL:
returnself.cast_options |
cyb70289
commented
Jan 21, 2021
Thanks @bkietz , I missed this point. |
Use unique_ptr to hold FunctionOptions derived classes instances to fix `invalid-offsetof` python build warnings. ~/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26034:146: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__CastOptions’ is undefined [-Winvalid-offsetof] x_type_7pyarrow_8_compute__CastOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__CastOptions, __pyx_base.__pyx_base.__weakref__);
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Use unique_ptr to hold FunctionOptions derived classes instances to fix `invalid-offsetof` python build warnings. ~/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26034:146: warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__CastOptions’ is undefined [-Winvalid-offsetof] x_type_7pyarrow_8_compute__CastOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__CastOptions, __pyx_base.__pyx_base.__weakref__); Closes#9274 from cyb70289/offsetof Authored-by: Yibo Cai <yibo.cai@arm.com> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
Use unique_ptr to hold FunctionOptions derived classes instances to fix
invalid-offsetofpython build warnings.~/arrow/python/build/temp.linux-x86_64-3.6/_compute.cpp:26034:146:
warning: offsetof within non-standard-layout type ‘__pyx_obj_7pyarrow_8_compute__CastOptions’ is undefined [-Winvalid-offsetof]
x_type_7pyarrow_8_compute__CastOptions.tp_weaklistoffset = offsetof(struct __pyx_obj_7pyarrow_8_compute__CastOptions, __pyx_base.__pyx_base.weakref);