Author belopolsky
Recipients belopolsky, mibanescu
Date 2010-07-12.15:05:45
SpamBayes Score 0.00103002
Marked as misclassified No
Message-id <1278947148.6.0.111751248396.issue6478@psf.upfronthosting.co.za>
In-reply-to
Content
Thank you for the bug report and a patch.

This does look like a bug and proposed patch seems to be the simplest way to fix it.  It is unfortunate that the entire TimeRE cache needs to be recalculated when only 'Z' entry is invalidated by TZ change.  Please consider separating lang and TZ change checks and not reinitialize TimeRE cache object if only TZ changes, just replace the 'Z' entry. 

 The patch also needs unit tests.  It should be straightforward to convert ttime.py into a test case.  Please add a test case for both test_time and test_datetime.  Note that in 3.2 datetime.strptime() will process '%Z' when '%z' is also present.  For example,


>>> datetime.strptime('Fri Jul 25 13:26:29 EDT -0500 2008', '%a %b %d %H:%M:%S %Z %z %Y')
datetime.datetime(2008, 7, 25, 13, 26, 29, tzinfo=datetime.timezone(datetime.timedelta(-1, 68400), 'EDT'))


Please make sure to restore environment variables in test cleanup.

Also a nit on the implementation: cls is unused in _get_timezone(cls), so it would be more appropriate to make it staticmethod instead of classmethod.  And tzset should probably be called inside _get_timezone.
History
Date User Action Args
2010-07-12 15:05:48belopolskysetrecipients: + belopolsky, mibanescu
2010-07-12 15:05:48belopolskysetmessageid: <1278947148.6.0.111751248396.issue6478@psf.upfronthosting.co.za>
2010-07-12 15:05:46belopolskylinkissue6478 messages
2010-07-12 15:05:45belopolskycreate