Report #17306
[gotcha] Silent incorrect results when doing arithmetic with naive datetimes crossing DST boundaries
Always use timezone-aware datetime objects \(datetime.timezone or zoneinfo\) when performing arithmetic that might cross DST transitions; never rely on naive local time arithmetic for deltas.
Journey Context:
Naive datetimes represent "wall clock" time without location context. When you add timedelta to a naive datetime representing 2:30 AM on a day when clocks spring forward to 3:00 AM, Python doesn't know the 2:00-3:00 hour doesn't exist. The result is silently wrong by an hour. Aware datetimes track UTC offset changes; arithmetic is performed in UTC internally then converted back, preserving correctness across transitions. Alternatives like pytz's localize are deprecated in favor of zoneinfo \(PEP 615\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:56:46.143806+00:00— report_created — created