Make datetime rust wrappers compatible with abi3 feature#4970
Make datetime rust wrappers compatible with abi3 feature#4970davidhewitt merged 5 commits intoPyO3:mainfrom
datetime rust wrappers compatible with abi3 feature#4970Conversation
27419dc to
a5615a2
Compare
|
Thanks for this one! While I can't find the discussion right now, I'm sure in the past something like this was proposed and at the time we chose not to add it. Quite often we've preferred not to add types in Rust for types that don't have a C API. That said, these datetime bindings are a bit of a special case given they do have a C API on the unlimited build. So it feels like maybe exposing them on all builds is the right choice, and we should view this more like a performance optimization when not running abi3. It would certainly simplify code in PyO3 and I'm sure downstream can benefit too. I'd be interested to hear if fellow maintainers have strong feelings we should not do this? |
|
(Otherwise I suggest we move ahead 👍) |
|
This seems fine to me, so 👍 from me as well. Having a unified interface seems generally easier to maintain an easier to use. |
newsfragments/4970.added.md
Outdated
| @@ -0,0 +1 @@ | |||
| - Added `utc`, `timezone` and `from_offset` constructors to 'PyTzInfo' | |||
There was a problem hiding this comment.
There is a long history of why those functions didn't exist, see #1588 (comment)
Maybe now we have easy ways to convert chrono timezones to TzInfo, these APIs are sort of available in a roundabout way anyway.
That said, I would prefer split these API changes out from this PR and focus on abi3 support here, if that's ok please?
There was a problem hiding this comment.
I removed the TzInfo constructors change from this PR and will follow this up in a future PR.
78e5b8a to
950e455
Compare
950e455 to
66a5955
Compare
66a5955 to
84872c5
Compare
davidhewitt
left a comment
There was a problem hiding this comment.
Thanks, this is a welcome simplification and usability improvement!
|
(Need #5041 before can merge...) |
This PR makes
PyDate,PyTime,PyDateTime,PyDelta, andPyTzInfoavailable inabi3builds. However,PyDateAccess,PyTimeAccess, andPyDeltaAccesshave not been enabled, as they can fail underabi3, and their return values are not PyResult, making error handling problematic.For now, fields in these wrappers should still be accessed using getattr, though we may consider changing this in the future.