[pywin32-bugs] [ pywin32-Bugs-3521185 ] win32timezone errors in dst/pst
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2012-04-26 14:36:37
|
Bugs item #3521185, was opened at 2012-04-24 16:54 Message generated for change (Comment added) made by bmatthews27 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3521185&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: win32timezone Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Brian Matthews (bmatthews27) Assigned to: Jason R. Coombs (jaraco) Summary: win32timezone errors in dst/pst Initial Comment: getWinInfo in timeZoneInfo class is return incorrect dynamic info return self.dynamicInfo.get(targetYear, self.dynamicInfo[RangeItemLast()]) self.dynamicInfo is a dictionary, not a List it should be something like: keys = self.dynamicInfo.keys().sort() return self.dynamicInfo.get(targetYear, self.dynamicInfo[keys[RangeItemLast()]]) ---------------------------------------------------------------------- Comment By: Brian Matthews (bmatthews27) Date: 2012-04-26 07:36 Message: thanks for the quick response... ---------------------------------------------------------------------- Comment By: Jason R. Coombs (jaraco) Date: 2012-04-25 18:29 Message: Fixed in aa3a7ed32634. It should be safe to copy win32timezone.py into an existing installation as a hotfix. ---------------------------------------------------------------------- Comment By: Brian Matthews (bmatthews27) Date: 2012-04-25 07:52 Message: The reason this occurs is getWinInfo returns the dynamic entry for 2006, and it should return the entry for 2007 ---------------------------------------------------------------------- Comment By: Jason R. Coombs (jaraco) Date: 2012-04-25 07:52 Message: Thanks for the update. I'll get it resolved promptly. ---------------------------------------------------------------------- Comment By: Brian Matthews (bmatthews27) Date: 2012-04-25 07:50 Message: Ok, my apologies I did not look deep enough. The problem is the utcoffset for years 2008-2012 are wrong. 2007 is OK For 2012 it thinks the dst switch is April-1, but it should be March 11 >>> from win32timezone import TimeZoneInfo >>> from datetime import datetime >>> tzi = TimeZoneInfo('Pacific Standard Time') >>> dt = datetime(2012,4,1) >>> print tzi.utcoffset(dt) -1 day, 16:00:00 >>> dt = datetime(2012,4,1,4) >>> print tzi.utcoffset(dt) -1 day, 17:00:00 ---------------------------------------------------------------------- Comment By: Jason R. Coombs (jaraco) Date: 2012-04-24 20:57 Message: self.dynamicInfo is a dictionary, but it is also a RangeMap. A RangeMap accepts RangeItemLast() as a parameter to .__getitem__ to retrieve the last item (see the docstring for RangeMap). Therefore, it should not be necessary to sort any keys manually. Additionally, the suggestion to use keys = self.dynamicInfo.keys().sort() and keys[RangeItemLast()] would not work because .sort() does not return a value and because RangeItemLast() is not an integer, but a special value indicating the last item in a RangeMap. I'm going to mark this ticket as invalid, because it does not provide any actionable symptoms. Can you provide an example of what you are calling, what you expect, and what happens instead? For me, all of the relevant tests still pass, but that doesn't mean that you haven't found a use case that doesn't work. Please describe it and I'll be more than happy to find a fix. Regards, Jason ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3521185&group_id=78018 |