Bug report
Bug description:
# Problem: datetime.timestamp() takes DST into account without any given timezone
# Expected: datetime.timestamp() does not calculate with DST if no timezone is available
# Python 3.14.6 (tags/v3.14.6:c63aec6, Jun 10 2026, 10:26:10) [MSC v.1944 64 bit (AMD64)] on win32
from datetime import datetime as dt
dt1 = dt(2026, 3, 29, 1, 59, 59) # Just before Daylight Saving Time
dt2 = dt(2026, 3, 29, 3, 0, 1) # Just after DST
print(dt1.tzinfo, dt2.tzinfo) # None None (As expected)
print(dt1) # 2026-03-29 01:59:59 (As expected)
print(dt2) # 2026-03-29 03:00:01 (As expected)
print(dt2-dt1, dt1.tzinfo, dt2.tzinfo) # 1:00:02 None None (As expected, 3602 seconds)
# Problem with timestamp()
dt1_ts = dt1.timestamp()
dt2_ts = dt2.timestamp()
print()
print(dt1_ts) # 1774745999.0 (As expected)
print(dt2_ts) # 1774746001.0 (Surprising !!!)
print(dt2_ts - dt1_ts) # 2.0 (Surprising, should be 3602 seconds like (dt2-dt1) !!!)
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
CPython versions tested on:
3.14
Operating systems tested on:
Windows