wrong utcoffset for aware datetimes

Bug #1485808 reported by Alex Becker on 2015-08-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Calling utcoffset on a timezone using an aware datetime returns a different result than for a naive timezone. This makes datetime's isoformat() function return incorrect results.

import datetime
from pytz import timezone

tz = timezone('US/Pacific')
naive = datetime.datetime(2000,6,1)
aware = naive.replace(tzinfo=tz)

assert(tz.utcoffset(naive) == tz.utcoffset(aware))

The assertion fails. Note that this happens with every datetime/timezone combination I've tried, not just US/Pacific and 2000-06-01.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers