Copilot commented on code in PR #55811:
URL: https://github.com/apache/arrow/pull/55811#discussion_r4766809830


##########
python/pyarrow/array.pxi:
##########
@@ -2717,6 +2717,68 @@ cdef class DurationArray(NumericArray):
     """
 
 
+cdef class MonthIntervalArray(Array):
+    """
+    Concrete class for Arrow arrays of interval[month] data type.
+    """
+
+    def to_pylist(self, *, maps_as_pydicts=None):
+        """
+        Convert to a list of native Python objects.
+
+        pyarrow.Month is used as the native representation.
+
+        Parameters
+        ----------
+        maps_as_pydicts : str, optional, default `None`
+            Valid values are `None`, 'lossy', or 'strict'.
+            This parameter is ignored for non-nested Scalars.
+
+        Returns
+        -------
+        lst : list
+        """
+        cdef:
+            CResult[PyObject*] maybe_py_list
+            PyObject* py_list
+            CMonthIntervalArray* array
+        array = <CMonthIntervalArray*>self.sp_array.get()
+        maybe_py_list = MonthIntervalArrayToPyList(deref(array))

Review Comment:
   Both new `to_pylist()` overrides bypass the CPU check in 
`Array.to_pylist()`, so converting an interval array copied to CUDA can crash 
when the C++ converter reads its buffers. Add `self._assert_cpu()` before 
conversion here and in `DayTimeIntervalArray.to_pylist()` at line 2777. Add a 
regression test confirming device-backed inputs raise `NotImplementedError`.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to