Skip to content

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

Open
LarryHu0217 wants to merge 1 commit into
python:mainfrom
LarryHu0217:codex/logging-dst-rollover-160433
Open

LarryHu0217 wants to merge 1 commit into
python:mainfrom
LarryHu0217:codex/logging-dst-rollover-160433

Conversation

@LarryHu0217

@LarryHu0217 LarryHu0217 commented Oct 24, 2026 •

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TimedRotatingFileHandler misnames backups around DST changes

1 participant