You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/01/22 13:35:42 UTC

[GitHub] [arrow] bkietz commented on a change in pull request #9274: ARROW-11299: [Python] Fix invalid-offsetof warnings

bkietz commented on a change in pull request #9274:
URL: https://github.com/apache/arrow/pull/9274#discussion_r562633900



##########
File path: python/pyarrow/_compute.pyx
##########
@@ -481,88 +481,89 @@ cdef class FunctionOptions(_Weakrefable):
 
 cdef class _CastOptions(FunctionOptions):
     cdef:
-        CCastOptions options
+        unique_ptr[CCastOptions] options
 
     __slots__ = ()  # avoid mistakingly creating attributes
 
     cdef const CFunctionOptions* get_options(self) except NULL:
-        return &self.options
+        return self.options.get()
 
     def _set_options(self, DataType target_type, allow_int_overflow,
                      allow_time_truncate, allow_time_overflow,
                      allow_float_truncate, allow_invalid_utf8):
+        self.options.reset(new CCastOptions())
         self._set_type(target_type)
         if allow_int_overflow is not None:
-            self.allow_int_overflow = allow_int_overflow
+            deref(self.options).allow_int_overflow = allow_int_overflow

Review comment:
       I'm not sure what you mean here. Note that `self.allow_int_overflow = ` is a property setter which modifies the corresponding field in CCastOptions, so substituting `deref(self.options).allow_int_overflow = ` here is unnecessary




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org