Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #159708.
Near the last explicit TZif transition, the recurring footer can select an offset that maps a local time to a UTC instant before the footer applies. In
America/Nuuk, this makes an ordinary local time use the wrong offset and change by an hour on a UTC round trip.Check the implied UTC instant before accepting the recurring rule's result; use the final explicit time type if that instant precedes the last transition. Apply the same check in the C and Python implementations.
The regression uses generated TZif data for single-transition and multiple-transition files. It checks offsets, DST, names, and UTC round trips around the boundary with both fold values, without depending on system timezone data.
Validation on Linux x86-64 debug builds:
test_zoneinfoandtest_datetimepassed in GIL and free-threaded builds (1,445 test cases each, 33 skips;tzdata==2025.3available)../python -m test -R 3:3 -m test_footer_fold_at_last_transition test_zoneinfopassed with no reference leaks in both builds.patchcheck, andgit diff --checkpassed.ZoneInfo.utcoffset()gives the wrong offset near the last explicit TZif transition #159708