Skip to content

gh-159706: Fix pure-Python ZoneInfo.fromutc() fold detection for single-transition zones - #159828

Merged
pganssle merged 1 commit into
python:mainfrom
lazerg:fix-issue-159706
Oct 21, 2026
Merged

pganssle merged 1 commit into
python:mainfrom
lazerg:fix-issue-159706

Conversation

@lazerg

@lazerg lazerg commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

In the pure-Python fromutc(), a zone with exactly one transition takes the timestamp > self._trans_utc[-1] branch, which used self._ttinfos[-1] (the offset after the transition) as tti_prev. That made the shift zero, so times in the fold got fold=0. This uses self._tti_before like the C implementation does, and adds a test.

@pganssle
pganssle merged commit 1c5b959 into python:main Oct 21, 2026
107 of 110 checks passed
@pganssle pganssle added 3.14 bugs and security fixes 3.15 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 21, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @lazerg for the PR, and @pganssle for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @lazerg for the PR, and @pganssle for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160151 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 21, 2026
@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160152 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 21, 2026
StanFromIreland pushed a commit that referenced this pull request Oct 22, 2026
…or single-transition zones (GH-159828) (#160152)

(cherry picked from commit 1c5b959)

Co-authored-by: Lazizbek Ergashev <lazerg2@gmail.com>
StanFromIreland pushed a commit that referenced this pull request Oct 22, 2026
…or single-transition zones (GH-159828) (#160151)

(cherry picked from commit 1c5b959)

Co-authored-by: Lazizbek Ergashev <lazerg2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.14 bugs and security fixes 3.15 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants