[Bug 885163] [NEW] pytz dst() incorrectly handles Pacific/Apia day leap
Launchpad Bug Tracker
885163 at bugs.launchpad.net
Mon Jan 9 17:32:34 UTC 2012
You have been subscribed to a public bug by Andreas Hasenack (ahasenack):
Request for SRU for Lucid, Maverick, Natty and Oneiric
======================================================
1. Impact
- Incorrect calculation of DST changes
- Landscape failure to accept new users or edit current users' setting
- "Django timezones app "timezones.zones" module unimportable" (reported on comment #11)
2. Development fix
The issue was fixed upstream in revision 268:
http://bazaar.launchpad.net/~stub/pytz/devel/revision/268
That is the diff grabbed for this SRU.
The same diff is also applied to the python-tz package in the current
ubuntu development version (precise).
3. Stable fix
The development fix applies cleanly to the stable releases.
4. Test case
Run the script below. If you get a backtrace, you are affected. If not, the bug is fixed in your environment:
#!/usr/bin/python
import pytz
from datetime import datetime
tz = pytz.timezone("Pacific/Apia")
d2 = datetime(2012,1,1)
local = tz.localize(d2)
local.dst()
print "All is good, NOT hit by bug #885163!"
5. Regression potential
Not sure, timezones can be tricky. I welcome comments from upstream for this section since I basically packaged their fix. The patch is minimal, and it fixed the problems we were having in our production servers.
Original bug description follows:
=================================
>>> from datetime import datetime
>>> import pytz
>>> tz = pytz.timezone('Pacific/Apia')
>>> d1 = datetime(2011, 11, 1)
>>> d2 = datetime(2012, 1, 1)
>>> tz.dst(d1)
datetime.timedelta(0, 3600)
>>> tz.dst(d2)
datetime.timedelta(1, 3600)
while utcoffset is correct:
>>> tz.utcoffset(d1)
datetime.timedelta(-1, 50400)
>>> tz.utcoffset(d2)
datetime.timedelta(0, 50400)
** Affects: pytz
Importance: High
Assignee: Stuart Bishop (stub)
Status: Fix Released
** Affects: python-tz (Ubuntu)
Importance: Undecided
Status: Fix Released
** Affects: python-tz (Ubuntu Lucid)
Importance: Undecided
Status: New
** Affects: python-tz (Ubuntu Maverick)
Importance: Undecided
Status: New
** Affects: python-tz (Ubuntu Natty)
Importance: Undecided
Status: New
** Affects: python-tz (Ubuntu Oneiric)
Importance: Undecided
Status: New
** Tags: patch
--
pytz dst() incorrectly handles Pacific/Apia day leap
https://bugs.launchpad.net/bugs/885163
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is subscribed to the bug report.
More information about the Ubuntu-sponsors
mailing list