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 commented on 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 commented on Oct 19, 2026
@lazerg Feel free to send a fix.
gh-159706: Fix pure-Python ZoneInfo.fromutc() fold detection for sing…
[3.15] gh-159706: Fix pure-Python ZoneInfo.fromutc() fold detection f…
[3.14] gh-159706: Fix pure-Python ZoneInfo.fromutc() fold detection f…