Peter J C Law added the comment:

Hi,

Sorry for the overkill demo. I've attached a much shorter version, the key 
portion of which seems to be that, for the case of UK summer time the timezone, 
the tzinfo's `dst()` and `utcoffset()` methods return the same value.

This results in the delta between the two (which my understanding suggests 
equates to the non-dst offset of the timezone) is zero (which is right).

The python implementations (both in datetime.py and in the docs) cope with this 
by checking the DST difference and applying this after the timezone adjustments 
have happened.

>From a look through the CPython implementation, it looks to me like it's 
>checking the wrong value before applying the DST difference. Specifically, on 
>line 3033 in Modules/_datetimemodule.c, it checks `delta` before applying the 
>DST.

For the majority of timezones this happens to work since the standard offset is 
not 0 and it ends up doing the addition anyway (and no functionality is lost if 
the DST value is 0).

Having tested changing the checked value to being dst rather than delta this 
does appear to fix this and all the existing tests still pass.

Peter

----------
Added file: http://bugs.python.org/file38372/time_issues.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23600>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to