Repository navigation
Determine datetime awareness from its UTC offset - #568
Closed
Gambit-Checkmate wants to merge 1 commit into
Closed
Gambit-Checkmate wants to merge 1 commit into
Gambit-Checkmate wants to merge 1 commit into
Conversation
Saadia751
reviewed
Oct 14, 2026
Saadia751
left a comment
There was a problem hiding this comment.
The utcoffset() definition handles a custom tzinfo returning None correctly. I compared naive, custom-naive and aware values against datetime.timestamp() with an explicit UTC assumption, including 1969, 2038, 2400 and offsets of −05:30 and +05:45.
Checked 6f73011197de with standalone Python 3.12.14 checks (20 passing assertions). I haven't run the full upstream suite.
mahmoud
added a commit
that referenced
this pull request
Oct 25, 2026
Owner
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
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.
The change
Determine datetime awareness through
utcoffset() is not Noneindt_to_timestamp, instead of tzinfo truthiness. Honor the documented UTC assumption for naive datetimes that carry tzinfo returning None, and preserve real offsets from false-valued timezone objects. Document this boundary and test microseconds, a pre-epoch value, false-valued timezone objects and standard offsets (-05:00, UTC, +05:30).Before the fix: two new regressions fail, and three standard-offset controls pass. After it:
python -m pytest --doctest-modules boltons tests -qpasses 683 tests and 12 subtests on Windows/Python 3.13.13.git diff --checkpasses. No dependency changes or local-time assumption introduced.The backstory
Following #551/#552 and #553/#554, this was inspected by Codex under the account owner's daily open-source contribution request. Comparing the converter with datetime's awareness definition exposed an exception and a wrong timestamp. No human production history is claimed; both failures and the regressions were run against unchanged master.
AI assistance
Fixes #566.
Hosted checks: GitHub Actions requires maintainer approval for this external contribution (action_required): https://github.com/mahmoud/boltons/actions/runs/37705698461 . Read the Docs build is pending. Full local tests passed as reported above.