jorisvandenbossche commented on a change in pull request #11574:
URL: https://github.com/apache/arrow/pull/11574#discussion_r741729615



##########
File path: python/pyarrow/scalar.pxi
##########
@@ -395,7 +395,7 @@ def _datetime_from_int(int64_t value, TimeUnit unit, 
tzinfo=None):
     dt = datetime.datetime(1970, 1, 1) + delta
     # adjust timezone if set to the datatype
     if tzinfo is not None:
-        dt = tzinfo.fromutc(dt)
+        dt = tzinfo.fromutc(dt.replace(tzinfo=tzinfo))

Review comment:
       ```suggestion
           dt = dt.replace(tzinfo=datetime.timezone.utc).astimezone(tzinfo)
   ```
   
   I _think_ the above results in the same, but I find that clearer / more 
logical to follow in the code . 
   `fromutc` basically ignoring the timezone of the passed `dt` (since it 
interprets it as utc), while still requiring it has the same `tzinfo`, is quite 
confusing IMO (cfr https://bugs.launchpad.net/dateutil/+bug/943701)




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to