wrong utcoffset for aware datetimes

Bug #1485808 reported by Alex Becker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pytz
New
Undecided
Unassigned

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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.