Report #22989
[gotcha] Why does comparing datetime objects raise TypeError?
Always use timezone-aware datetime objects for absolute timestamps: \`datetime.now\(timezone.utc\)\` instead of \`datetime.now\(\)\`. Never compare naive and aware objects; convert explicitly first.
Journey Context:
Python 3.3\+ forbids comparison between naive \(no tzinfo\) and aware \(has tzinfo\) datetimes to prevent silent calculation errors. Naive datetimes represent ambiguous local wall-clock time that may not exist or occur twice during DST transitions. Aware datetimes represent absolute points in UTC. The fix requires using \`datetime.now\(timezone.utc\)\` or \`datetime.fromtimestamp\(ts, tz=timezone.utc\)\`. Comparing two naive objects is allowed but risky across timezone boundaries or DST shifts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T17:00:01.219386+00:00— report_created — created