Skip to content

gh-160433: Correct timed log backup names across DST changes - #160564

Merged
vsajip merged 1 commit into
python:mainfrom
LarryHu0217:codex/logging-dst-rollover-160433
Oct 24, 2026
Merged

vsajip merged 1 commit into
python:mainfrom
LarryHu0217:codex/logging-dst-rollover-160433

Conversation

@LarryHu0217

@LarryHu0217 LarryHu0217 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #160433.

Keep fixed-duration interval start timestamps unshifted when naming timed log backups. For midnight and weekly intervals, base DST compensation on the scheduled rollover boundary rather than the time a possibly delayed record arrives.

This prevents the reported misnamed backups and skipped rotations caused by colliding names. Rollover scheduling, retention and UTC behavior are unchanged.

Adds deterministic filesystem regressions for hourly and daily intervals across spring/fall transitions, delayed midnight and weekly rotations, and sparse logging with atTime. Every case has a UTC control, and a Library NEWS entry is included.

Validation on macOS arm64 using an existing --with-pydebug configuration rebuilt at dc28c3a358221b1e0ae5f926b72e112cbd1d03f7 (CPython 3.16.0a1+dev):

  • make -j2: pass.
  • Against unchanged upstream handlers, all seven local-time regression subcases fail filename/content assertions while the seven UTC controls pass. All 14 subcases pass after the fix.
  • ./python.exe -B -m test -v -u network,cpu,walltime --timeout 600 test_logging test_time test_datetime test_queue: all four suites succeed; reported run=1,752, skipped=45 (platform, implementation, permissions and large-memory conditions).
  • ./python.exe -B -m test -R 3:3 -m 'test_rollover_*_dst' test_logging: success, with no positive leaks in the three measured repetitions.
  • Unmodified Tools/patchcheck/patchcheck.py, scoped ruff check --no-fix --no-cache Lib/logging/handlers.py Lib/test/test_logging.py and git diff --cached --check: pass.

Ruff was the existing 0.15.22 binary, with its Python-3.15-support warning retained; the hook pins 0.15.17 and the full hook runner was not installed or run. The entire CPython test suite was not run locally.

@vsajip
vsajip merged commit 457ba33 into python:main Oct 24, 2026
59 checks passed
@vsajip vsajip added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 24, 2026
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

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

@bedevere-app

bedevere-app Bot commented Oct 24, 2026

Copy link
Copy Markdown

GH-160577 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 24, 2026
@bedevere-app

bedevere-app Bot commented Oct 24, 2026

Copy link
Copy Markdown

GH-160578 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 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TimedRotatingFileHandler misnames backups around DST changes

2 participants