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
wrong time.timezone #66988
Comments
$ TZ=:Europe/Moscow ./python -mtest -v test_time
====================================================================== Traceback (most recent call last):
File ".../Lib/test/test_time.py", line 721, in test_localtime_timezone
self.assertEqual(lt.tm_gmtoff, -[time.timezone, time.altzone][lt.tm_isdst])
AssertionError: 10800 != 14400
Ran 45 tests in 1.832s FAILED (failures=1, skipped=3) UTC offset had changed on 2014-10-26 in Europe/Moscow timezone from Python time.timezone returns -14400 (old utc offset) despite C timezone Similar case where timezone, altzone may be wrong The issue again http://bugs.python.org/issue22798 is that time timezone |
This issue could be fixed using sync-time-timezone-attr-with-c.diff patch from http://bugs.python.org/issue22798 |
Isn't this a duplicate of bpo-13466? |
In what way is it a duplicate? |
Please take a look at msg148208. I agree with MAL that time module globals timezone and daylight should be deprecated in favor of tm_gmtoff or datetime.astimezone(). |
I agree that time.timezone, time.altzone is not enough in the general *Nothing* works in the general case. Nothing. But it doesn't mean that the current behaviour of time.timezone lt = time.localtime() # in a short-lived script
assertEqual(lt.tm_gmtoff, -[time.timezone, time.altzone][lt.tm_isdst]) The test checks values for the current time (time.localtime()). Perhaps synchronizing time.timezone with C timezone variable as I've |
Closing. See bpo-22798 for the reasons why synchronizing C variables with the time module constants is not a solution. |
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: