-
-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time_test fails after strptime() #66265
Comments
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
... ====================================================================== 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 bpo-13309. |
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. |
I am unable to reproduce this on 3.11. |
Yes, it was 2.7-only issue. Thank you Irit for checking and closing outdated issues. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: