_FixedOffset.normalize() doesn't correctly change the timezone
Bug #1595253 reported by
Dale Hui
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Fix Released
|
High
|
Stuart Bishop |
Bug Description
In _FixedOffset:
def normalize(self, dt, is_dst=False):
'''Correct the timezone information on the given datetime'''
if dt.tzinfo is None:
raise ValueError('Naive time - no tzinfo set')
return dt.replace(
should be:
def normalize(self, dt, is_dst=False):
'''Correct the timezone information on the given datetime'''
if dt.tzinfo is self:
return dt
if dt.tzinfo is None:
raise ValueError('Naive time - no tzinfo set')
return dt.astimezone(self)
Changed in pytz: | |
importance: | Undecided → High |
assignee: | nobody → Stuart Bishop (stub) |
status: | Triaged → Fix Committed |
Changed in pytz: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
In what circumstances does the current implementation fail? datetimes with a FixedOffset tzinfo should never need adjustment by normalize(),