This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年11月01日 14:05 by flox, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (17) | |||
|---|---|---|---|
| msg146776 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月01日 14:05 | |
After changeset 55a3b563f0db the Gentoo buildbot is complaining. ====================================================================== FAIL: test_strptime (test.test_time.TimeTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/test_time.py", line 159, in test_strptime time.strptime(strf_output, format) ValueError: time data 'LMT' does not match format '%Z' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/test_time.py", line 162, in test_strptime (format, strf_output)) AssertionError: conversion specifier '%Z' failed with 'LMT' input. ---------------------------------------------------------------------- |
|||
| msg146778 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月01日 14:12 | |
New changeset 2771f7e96a52 by Florent Xicluna in branch 'default': Add temporary tests to troubleshoot issue #13309 on Gentoo buildbot. http://hg.python.org/cpython/rev/2771f7e96a52 |
|||
| msg146780 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月01日 15:07 | |
New changeset bb0ae7df08f8 by Florent Xicluna in branch 'default': Troubleshoot issue #13309 on Gentoo buildbot. http://hg.python.org/cpython/rev/bb0ae7df08f8 |
|||
| msg146784 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月01日 16:06 | |
New changeset 5b1e1967ea9d by Florent Xicluna in branch 'default': Replace temporary tests with the real test case for issue #13309 on Gentoo. http://hg.python.org/cpython/rev/5b1e1967ea9d |
|||
| msg146787 - (view) | Author: Ross Lagerwall (rosslagerwall) (Python committer) | Date: 2011年11月01日 16:22 | |
"""
import time
import sys
t = time.gmtime(time.time())
s = time.strftime('%Z', t)
print(s)
time.mktime((-1, 1, 1, 0, 0, 0, -1, -1, -1))
t = time.gmtime(time.time())
s = time.strftime('%Z', t)
print(s)
"""
outputs:
SAST
LMT
on my Gentoo box. I'm still figuring out why...
|
|||
| msg146790 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月01日 16:40 | |
It seems that "mktime" is buggy on Gentoo.
You can try to reset its state in some way before to retry strftime:
t = time.gmtime(time.time())
s = time.strftime('%Z', t)
print(s)
time.mktime((-1, 1, 1, 0, 0, 0, -1, -1, -1))
s = time.strftime('%Z', t)
print(s)
time.mktime((1, 1, 1, 0, 0, 0, 0, 0, -1))
s = time.strftime('%Z', t)
print(s)
I guess it could output:
SAST
LMT
SAST
|
|||
| msg146791 - (view) | Author: Ross Lagerwall (rosslagerwall) (Python committer) | Date: 2011年11月01日 16:45 | |
It outputs:
SAST
LMT
LMT
An equivalent C program to the first test:
"""
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main() {
time_t t;
struct tm *tmp;
t = time(NULL);
tmp = localtime(&t);
char str[200];
strftime(str, sizeof(str), "%Z", tmp);
puts(str);
struct tm tmp2;
tmp2.tm_sec = 0;
tmp2.tm_min = 0;
tmp2.tm_hour = 0;
tmp2.tm_mday = 1;
tmp2.tm_mon = 1;
tmp2.tm_year = -1;
tmp2.tm_wday = -1;
tmp2.tm_yday = -1;
tmp2.tm_isdst = -1;
mktime(&tmp2);
t = time(NULL);
tmp = localtime(&t);
strftime(str, sizeof(str), "%Z", tmp);
puts(str);
return 0;
}
"""
Outputs (as expected):
SAST
SAST
Perhaps it's not mktime?
|
|||
| msg146798 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月01日 17:49 | |
See also issue #13313 on timezone, seen on x86 FreeBSD 7.2 |
|||
| msg147081 - (view) | Author: Vinay Sajip (vinay.sajip) * (Python committer) | Date: 2011年11月05日 12:07 | |
It's not just Gentoo. I get this error repeatably on Ubuntu Oneiric 64- bit and Linux Mint Katya 64-bit, though not on the 32-bit variants. |
|||
| msg147122 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年11月05日 23:46 | |
I also get this error on Mageia. If this can't be fixed, the test should be skipped or removed. |
|||
| msg147266 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月07日 23:27 | |
LMT stands for Local Mean Time. I found a report of someone having an issue parsing timezone with Python 2.6. Looks quite similar. http://www.aczoom.com/forums/blockhosts/mar-10-151801-domains-blockhosts5599-error-failed-to-parse-date-for-ip-18911419951 |
|||
| msg147413 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年11月10日 23:38 | |
It is definitely a glibc issue. Here's a C snippet to reproduce:
"""
#include <time.h>
#include <stdlib.h>
int main() {
time_t t;
struct tm tmp;
char str[200];
t = time(NULL);
tmp = *gmtime(&t);
tmp.tm_gmtoff = 0;
tmp.tm_zone = NULL;
strftime(str, sizeof(str), "%Z", &tmp);
puts(str);
t = -2461446500;
localtime(&t);
t = time(NULL);
tmp = *gmtime(&t);
tmp.tm_gmtoff = 0;
tmp.tm_zone = NULL;
strftime(str, sizeof(str), "%Z", &tmp);
puts(str);
return 0;
}
"""
Output:
CET
PMT
Calling localtime() or mktime() with a time largely in the past seems to corrupt the glibc's internal time structures (the "char *tm_zone[]").
|
|||
| msg147417 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月11日 02:09 | |
New changeset 05164831011e by Antoine Pitrou in branch 'default': Avoid a glibc bug in test_time (issue #13309) http://hg.python.org/cpython/rev/05164831011e |
|||
| msg147418 - (view) | Author: Ross Lagerwall (rosslagerwall) (Python committer) | Date: 2011年11月11日 04:19 | |
Has it been reported? |
|||
| msg147426 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年11月11日 11:15 | |
> Has it been reported? Yes, in http://sourceware.org/bugzilla/show_bug.cgi?id=13401 |
|||
| msg147440 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月11日 18:00 | |
New changeset bcd347cd6bf2 by Florent Xicluna in branch 'default': Use unittest.skipUnless to skip the test related to the glibc bug, issue #13309. http://hg.python.org/cpython/rev/bcd347cd6bf2 |
|||
| msg147441 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月11日 18:02 | |
Thank you for the investigation, and the bug report to the glibc team. I propose to close it as "won't fix". |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:23 | admin | set | github: 57518 |
| 2011年11月16日 16:35:20 | flox | set | status: pending -> closed |
| 2011年11月11日 18:02:09 | flox | set | status: open -> pending resolution: wont fix messages: + msg147441 stage: test needed -> resolved |
| 2011年11月11日 18:00:17 | python-dev | set | messages: + msg147440 |
| 2011年11月11日 11:15:19 | pitrou | set | messages: + msg147426 |
| 2011年11月11日 04:19:34 | rosslagerwall | set | messages: + msg147418 |
| 2011年11月11日 02:09:20 | python-dev | set | messages: + msg147417 |
| 2011年11月10日 23:38:13 | pitrou | set | messages: + msg147413 |
| 2011年11月09日 19:45:27 | nadeem.vawda | set | nosy:
+ nadeem.vawda |
| 2011年11月07日 23:27:54 | flox | set | messages:
+ msg147266 components: + Library (Lib) |
| 2011年11月06日 03:21:24 | Arfrever | set | nosy:
+ Arfrever |
| 2011年11月05日 23:46:43 | pitrou | set | nosy:
+ pitrou messages: + msg147122 |
| 2011年11月05日 12:07:54 | vinay.sajip | set | nosy:
+ vinay.sajip messages: + msg147081 |
| 2011年11月03日 14:27:51 | pitrou | set | priority: normal -> deferred blocker |
| 2011年11月01日 17:49:43 | flox | set | messages: + msg146798 |
| 2011年11月01日 16:58:28 | flox | set | nosy:
+ belopolsky |
| 2011年11月01日 16:45:48 | rosslagerwall | set | messages: + msg146791 |
| 2011年11月01日 16:40:16 | flox | set | messages: + msg146790 |
| 2011年11月01日 16:22:03 | rosslagerwall | set | nosy:
+ rosslagerwall messages: + msg146787 |
| 2011年11月01日 16:06:54 | python-dev | set | messages: + msg146784 |
| 2011年11月01日 15:07:41 | python-dev | set | messages: + msg146780 |
| 2011年11月01日 14:12:51 | python-dev | set | nosy:
+ python-dev messages: + msg146778 |
| 2011年11月01日 14:05:03 | flox | create | |