rmnskb commented on PR #47461:
URL: https://github.com/apache/arrow/pull/47461#issuecomment-3243207668
> > I've started implementing the `__repr__` dunders for the classes that
you've mentioned in #47358, however, now I stumbled upon `FlightCallOptions`'s
arguments not being convertable back to Python objects after they are set as C
objects inside `FlightCallOptions.options`.
>
> I'm not sure what you mean, because if you define the `__repr__` in Cython
you should be able to access the C-level attributes. You may need to add the
necessary API declarations for C++ Flight types.
>
> For example, this change works for me:
>
> ```diff
> diff --git a/python/pyarrow/_flight.pyx b/python/pyarrow/_flight.pyx
> index fe2e1b3d67..ca842f35bb 100644
> --- a/python/pyarrow/_flight.pyx
> +++ b/python/pyarrow/_flight.pyx
> @@ -142,6 +142,10 @@ cdef class FlightCallOptions(_Weakrefable):
> return &((<FlightCallOptions> obj).options)
> raise TypeError(f"Expected a FlightCallOptions object, not
'{type(obj)}'")
>
> + def __repr__(self):
> + # Draft implementation, should be improved
> + return
f'FlightCallOptions(timeout={self.options.timeout.count()})'
> +
>
> _CertKeyPair = collections.namedtuple('_CertKeyPair', ['cert', 'key'])
>
> diff --git a/python/pyarrow/includes/libarrow_flight.pxd
b/python/pyarrow/includes/libarrow_flight.pxd
> index b1af6bcb4f..f2b15fb706 100644
> --- a/python/pyarrow/includes/libarrow_flight.pxd
> +++ b/python/pyarrow/includes/libarrow_flight.pxd
> @@ -272,6 +272,7 @@ cdef extern from "arrow/flight/api.h" namespace
"arrow" nogil:
>
> cdef cppclass CTimeoutDuration" arrow::flight::TimeoutDuration":
> CTimeoutDuration(double)
> + double count()
>
> cdef cppclass CFlightCallOptions" arrow::flight::FlightCallOptions":
> CFlightCallOptions()
> ```
Hm, that's interesting, since the same changes have segfaulted for me 🤔
Ok, thanks for the confirmation, I will look into that further.
--
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]