Repository navigation
Conversation
Wkhanex
reviewed
Oct 12, 2026
There was a problem hiding this comment.
I checked the changed astimezone method against stdlib behavior for naive, UTC-aware and ZoneInfo-aware datetimes. In all three controls, omitting the argument matched explicit None and the stdlib local-timezone conversion. The existing _new reconstruction path is retained by the patch. A naive input regression would complement the new UTC-aware test, since datetime.astimezone also permits naive inputs. I ran these checks on Python 3.12 using the exact method in a datetime subclass adapter; TOML parsing/trivia reconstruction and the full package tests were not run.
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.
Summary
Parsed
DateTimeobjects rejectvalue.astimezone()because the wrapper requirestz, while nativedatetime.astimezone()defaults to the local timezone. Give the wrapper the same optional argument, preserving its existing explicit-timezone behavior and wrapped result type.Validation: the new regression fails on the unchanged source; all 1185 tests, including the pinned toml-test fixtures, pass after the change. Applicable pre-commit hooks pass. Mypy reports the identical six existing errors on the base and this branch (submodule generator excluded), with no new errors.
Agent Drafting Metadata
tomlkit/items.py,tests/test_items.pyandCHANGELOG.mdwere prepared with this agent.