Open gibsondan opened 8 months ago
This appears to be a bug in ZoneInfo that moved into pendulum in the 3.0 release now that TimeZone subclasses ZoneInfo.
Simple repro:
In a Docker container:
FROM python:3.10-slim RUN pip install pendulum RUN echo "Asia/Shanghai" > /etc/timezone
Then in Python:
import pendulum, datetime pendulum.UTC.utcoffset(datetime.datetime(2024, 3, 12, 0, 0, 0, 0)))
outputs datetime.timedelta(seconds=28800) (the utcoffset of the timezone in /etc/timezone) instead of the expected None return value for UTC.
datetime.timedelta(seconds=28800)
This breaks all kinds of things.
The same issue happens with a ZoneInfo object:
See https://stackoverflow.com/questions/74467999/why-does-zoneinfoutc-do-different-time-conversions-from-timezone-utc for a similar report on ZoneInfo.
Filed this in cpython too since it seems the bug here is really in ZoneInfo not pendulum: https://github.com/python/cpython/issues/116676
Issue
This appears to be a bug in ZoneInfo that moved into pendulum in the 3.0 release now that TimeZone subclasses ZoneInfo.
Simple repro:
In a Docker container:
Then in Python:
outputs
datetime.timedelta(seconds=28800)
(the utcoffset of the timezone in /etc/timezone) instead of the expected None return value for UTC.This breaks all kinds of things.
The same issue happens with a ZoneInfo object:
See https://stackoverflow.com/questions/74467999/why-does-zoneinfoutc-do-different-time-conversions-from-timezone-utc for a similar report on ZoneInfo.