You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pure-Python ZoneInfo.fromutc() misses folds in zones with a single transition #159706
The pure-Python implementation should give the same result as the C implementation. Rothera's offset moved from UTC to UTC−03 at 1976-12-01 00:00 UTC, so this instant is in the second occurrence of 22:00 local time and should have fold=1. Instead, the result has fold=0 and converting it back to UTC loses three hours.
In the single-transition branch of fromutc(), tti_prev is set to self._ttinfos[-1], which is the offset after the transition. It matches self._tz_after, so the calculated shift is zero. I think this branch needs to use self._tti_before as the previous offset, as the C implementation already does.
Activity
lazerg commentedon Oct 19, 2026
I can reproduce this and have the one-line fix with a test ready. Are you planning to fix it yourself, or would you like me to open a PR?
pganssle commentedon Oct 19, 2026
@lazerg Feel free to send a fix.