Repository navigation
Conversation
Apply the default timezone only when the timestamp has no timezone, including when the default is None. Fixes apache#2254 Assisted-by: Codex:GPT-6
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.
Description
Fixes #2254.
parse_date("2026-12-01T12:34:56Z", default_timezone=FixedOffset(5, 30, "+05:30"))currently returns a +05:30 timestamp. Withdefault_timezone=None, it drops timezone information altogether. An explicitZmust mean UTC; the fallback is only for input with no zone.Return UTC for
Zinparse_timezone. Regression tests cover positive, negative and None defaults through both the timezone helper and date parser, plus unchanged fallback and numeric-offset behavior. Three subcases fail before the fix.This is independent of #2243 and #2245: it changes only the explicit-UTC branch, leaving fraction parsing and optional fields alone.
Status
Done, ready for review.
Checklist
AI assistance: Codex (GPT-6) reproduced the bug, implemented and reviewed the fix, and ran validation. No human review before posting.
Validation note:
BaseConnectionClassTestCase.test_connection_timeout_raisedexpects a connect timeout from10.255.255.1, but this machine receives a read timeout or connection reset instead. The same test fails on an untouchedorigin/trunkworktree. The change does not touch connection handling.