X Tutup
Skip to content

Negative timestamp failure during DST on Windows #145731

@hugovk

Description

@hugovk

Bug report

Bug description:

The AMD64 Windows10 3.x buildbot has started failing:

======================================================================
FAIL: test_fromtimestamp_low_fold_detection (test.datetimetester.TestLocalTimeDisambiguation_Fast.test_fromtimestamp_low_fold_detection)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\datetimetester.py", line 6431, in test_fromtimestamp_low_fold_detection
    self.assertEqual(datetime.fromtimestamp(0).fold, 0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1 != 0
======================================================================
FAIL: test_mktime (test.test_time.TimeTestCase.test_mktime)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_time.py", line 542, in test_mktime
    self.assertEqual(t1, t)
    ~~~~~~~~~~~~~~~~^^^^^^^
AssertionError: 3598.0 != -2

----------------------------------------------------------------------
Ran 64 tests in 3.432s

The US switched to DST on Sunday 8th March.

Only this Windows buildbot fails, it's on EST/EDT:

Last pass:

  • datetime.datetime.now: 2026-03-07 09:09:35 (local)
  • time.time: 1772892576 → 2026-03-07 14:09:36 UTC
  • Offset: 5 hours → UTC-5 → EST

First fail:

  • datetime.datetime.now: 2026-03-08 23:01:25 (local)
  • time.time: 1773025286 → 2026-03-09 03:01:26 UTC
  • Offset: 4 hours → UTC-4 → EDT

GitHub Actions is on UTC, so it passes.

Bug likely introduced by #143463, merged in January during standard time, so the tests passed.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup