jorisvandenbossche commented on a change in pull request #12522:
URL: https://github.com/apache/arrow/pull/12522#discussion_r832306534
##########
File path: cpp/src/arrow/python/datetime.cc
##########
@@ -426,8 +427,19 @@ Result<PyObject*> StringToTzinfo(const std::string& tz) {
return tzinfo;
}
+ if (internal::ImportModule("zoneinfo", &zoneinfo).ok()) {
+ RETURN_NOT_OK(internal::ImportModule("zoneinfo", &zoneinfo));
+
+ OwnedRef class_zoneinfo;
+ RETURN_NOT_OK(internal::ImportFromModule(zoneinfo.obj(), "ZoneInfo",
&class_zoneinfo));
Review comment:
And in that case, we can probably fall back to the stdlib
`datetime.timezone`, which handles fixed offsets?
##########
File path: cpp/src/arrow/python/datetime.cc
##########
@@ -426,8 +427,19 @@ Result<PyObject*> StringToTzinfo(const std::string& tz) {
return tzinfo;
}
+ if (internal::ImportModule("zoneinfo", &zoneinfo).ok()) {
+ RETURN_NOT_OK(internal::ImportModule("zoneinfo", &zoneinfo));
+
+ OwnedRef class_zoneinfo;
+ RETURN_NOT_OK(internal::ImportFromModule(zoneinfo.obj(), "ZoneInfo",
&class_zoneinfo));
Review comment:
You will probably need to check `MatchFixedOffset`, to ensure we don't
pass a fixed offset string to `zoneinfo.ZoneInfo`
--
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]