-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In pyo3-arrow, I'm converting from Arrow scalars to Python objects.
Prior to pyo3 0.23.4, pyo3 handled the object conversion by converting all time zones to a fixed offset, but as of pyo3 0.23.4, pyo3 requires the Tz
implementation to implement IntoPyObject
, and arrow_array::timezone::Tz
does not.
One way to fix this is to converting all time zones to a fixed offset manually, e.g.
let dt: chrono::DateTime<arrow_array::timezone::Tz> = ...;
dt.fixed_offset().into_py_any(py)?
But this loses timezone information. It would be ideal to convert all timezone information into the Python scalar. But TzInner is private:
arrow-rs/arrow-array/src/timezone.rs
Lines 81 to 85 in a0c3186
#[derive(Debug, Copy, Clone)] | |
enum TzInner { | |
Timezone(chrono_tz::Tz), | |
Offset(FixedOffset), | |
} |
So we have no way to access the underlying chrono_tz::Tz
out of the Tz
.
Describe the solution you'd like
Make TzInner
public.
Describe alternatives you've considered
Always convert to a fixed offset, but this will lose any timezone information.
Additional context