Issue22067
Created on 2014-07-25 15:05 by serhiy.storchaka, last changed 2015-12-03 21:40 by serhiy.storchaka.
Messages (2) | |||
---|---|---|---|
msg223955 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2014-07-25 15:05 | |
time_test fails when running after any test which uses strptime(). The bug can be easily reproduced by running test_time twice: $ TZ=Europe/Kiev ./python -m test.regrtest -ugui -v test_time test_time ... ====================================================================== FAIL: test_strptime (test.test_time.TimeTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/serhiy/py/cpython-2.7/Lib/test/test_time.py", line 120, in test_strptime (format, strf_output)) AssertionError: conversion specifier '%Z' failed with 'MSK' input. ---------------------------------------------------------------------- All works on 3.x and with TZ=UTC. May be this is related to issue13309. |
|||
msg255842 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2015-12-03 21:40 | |
If call time.localtime() with time before 1990-03-25T03:00, EET is turned to MSK. I guess this is a time when the Europe/Kiev timezone was introduced. >>> import os, time >>> os.environ['TZ'] = 'Europe/Kiev' >>> time.tzset() >>> time.localtime(638319599) time.struct_time(tm_year=1990, tm_mon=3, tm_mday=25, tm_hour=1, tm_min=59, tm_sec=59, tm_wday=6, tm_yday=84, tm_isdst=0) >>> time.strftime('%Z', time.gmtime()) 'MSK' >>> time.localtime(638319600) time.struct_time(tm_year=1990, tm_mon=3, tm_mday=25, tm_hour=3, tm_min=0, tm_sec=0, tm_wday=6, tm_yday=84, tm_isdst=1) >>> time.strftime('%Z', time.gmtime()) 'EET' C function localtime() implicitly calls tzset() and sets global C variables tzname, timezone, and daylight, but these changes are not exposed as variables in the time module. C and Python ideas about timezone becomes different. This looks as a bug in time.localtime() and other functions that implicitly change timezone variables. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2015-12-03 21:40:04 | serhiy.storchaka | set | messages: + msg255842 |
2014-11-17 12:41:35 | serhiy.storchaka | set | nosy:
+ belopolsky, pitrou |
2014-07-25 15:05:06 | serhiy.storchaka | create |